linuxtool/Config/Web/acme/manage.sh

34 lines
1004 B
Bash
Raw Permalink Normal View History

2024-09-27 14:22:23 +08:00
#!/bin/bash
echo "1.查看已经成功申请证书的域名"
declare user_choice
read -p "请输入选择:" user_choice
2024-09-27 14:22:23 +08:00
case $user_choice in
2024-09-27 14:22:23 +08:00
'1')
declare certificate_name
declare certificate_count=0
declare -a certificate_array
2024-09-27 14:22:23 +08:00
for i in "${HOME}/.acme.sh"/* ; do
certificate_name=$(basename $i )
if ! echo "$certificate_name" | grep -q "_ecc" ; then
2024-09-27 14:22:23 +08:00
continue
fi
certificate_name=$(echo $certificate_name | sed "s/_ecc//g" )
certificate_count=$(( certificate_count+1 ))
certificate_array[$certificate_count]=$certificate_name
echo "${certificate_count}.${certificate_name}"
2024-09-27 14:22:23 +08:00
done
if [ ${#certificate_array[@]} == 0 ]; then
2024-09-27 14:45:16 +08:00
echo "暂时没有安装证书"
exit
fi
read -p "请输入要查看证书详细信息的序号:" user_choice
if [[ $user_choice =~ [1-${#certificate_array[@]}] ]]; then
bash "${HOME}/.acme.sh/acme.sh -info -d ${certificate_array[$user_choice]}"
2024-09-27 14:22:23 +08:00
else
echo "选择错误"
fi
;;
esac