自动更新ssl证书
@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 root@8.2x0.xx.2x2:/etc/nginx/certs/rx.xxn.crt %nginx_ssl_path% scp root@8.2x0.x3.2x2:/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 root@8.2x0.x3.232:/etc/nginx/certs/rv.cxn.crt /etc/ssl/rxn.crt scp -P 9922 root@8.2x0.x3.232:/etc/nginx/certs/rv.cxn.key /etc/ssl/rxn.key systemctl restart nginx fi