@echo off setlocal set "nginx_home=C:\phpEnv\server\nginx" set "nginx_ssl_path=C:\phpEnv\server\nginx\certs\" (openssl x509 -in %nginx_ssl_path%\rxn.crt -checkend 86400) | findstr /c:"not" >nul if %errorlevel% == 0 ( echo "证书还没有过期,不需要更新!" ) else ( echo "证书将在24小时内过期,执行更新操作:" scp [email protected]:/etc/nginx/certs/rx.xxn.crt %nginx_ssl_path% scp [email protected]:/etc/nginx/certs/rx.cxn.key %nginx_ssl_path% %nginx_home%\nginx.exe -p %nginx_home% -s reload echo "执行完成!" )
#!/bin/sh if openssl x509 -in /etc/ssl/rxn.crt -checkend 86400 |grep "not" then echo "证书并没有过期(超过24小时)!" else echo "证书将在24小时内过期,立即进行更新处理!" scp -P 9922 [email protected]:/etc/nginx/certs/rv.cxn.crt /etc/ssl/rxn.crt scp -P 9922 [email protected]:/etc/nginx/certs/rv.cxn.key /etc/ssl/rxn.key systemctl restart nginx fi
标签:自动更新,crt,etc,证书,echo,ssl,certs,nginx From: https://www.cnblogs.com/zhahost/p/17578455.html