mirror of
https://github.com/10h30/ols-docker-env.git
synced 2026-05-12 23:31:35 +09:00
acme scrip add
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user