从自己的github上自动获取证书并部署到本地

web

之前在github 下用两个库实现了自动更新 地址 :https://dev.leiyanhui.com/web/auto-get-ssl

这里记录下 使用的时候自动部署的方法
以alpine下为例

plaintext
apk add nano wget p7zip
rc-update add crond boot
service crond start
cd /root
nano auto-updatessl-form-github.sh 

内容

plaintext
cat > auto-updatessl-form-github.sh   << EOF
cd /root
rm ssl.zip*
wget https://cdn.jsdelivr.net/gh/XXXX/sXXXX.zip #https://github.com/XXXXXXXXXXXXX.zip
if [ ! -f "/root/ssl.zip" ]; then
 wget -O/dev/null -q https://api.day.app/你的key/SSL-update-err/[home-mino]?sound=birdsong&amp;isArchive=1
else
  rm -rf ssl
  7z x ssl.zip  -p密码  #密码和p之间不能有空格
  supervisorctl restart minio #根据情况修改
  nginx -s reload
fi
EOF
echo "15 8 * * * sh /root/auto-updatessl-form-github.sh" >> /etc/crontabs/root  && cat /etc/crontabs/root

添加计划任务 crontab -e 每天7点50

bash
50 7 * * * sh /root/auto-updatessl-form-github.sh

评论