acme scrip add

This commit is contained in:
Cold-Egg
2020-02-19 17:00:06 -05:00
parent 1194aae4f1
commit 5bda22907d
2 changed files with 170 additions and 58 deletions
+14 -8
View File
@@ -1,12 +1,18 @@
#!/bin/bash
BOTCRON='/etc/cron.d/certbot'
BOTCRON='/var/spool/cron/crontabs/root'
certbothook(){
grep 'lswsctrl restart' ${BOTCRON} >/dev/null
if [ ${?} = 1 ]; then
echo 'Add LSWS hook to certbot cronjob.'
sed -i 's/0.*renew/& --deploy-hook "\/usr\/local\/lsws\/bin\/lswsctrl restart"/g' ${BOTCRON}
fi
cert_hook(){
grep 'acme' ${BOTCRON} >/dev/null
if [ ${?} = 0 ]; then
grep 'lswsctrl' ${BOTCRON} >/dev/null
if [ ${?} = 0 ]; then
echo 'Hook already exist, skip!'
else
sed -i 's/--cron/--cron --renew-hook "\/usr\/local\/lsws\/bin\/lswsctrl restart"/g' ${BOTCRON}
fi
else
echo "[X] ${BOTCRON} does not exist, please check it later!"
fi
}
certbothook
cert_hook