cronjob -e
Add following line:
/usr/bin/certbot renew --standalone --pre-hook "service nginx stop" --post-hook "service nginx start"
will does not work!!!
Because PATH is not same when you run this command on your account and when system run this command on CRONTAB mode
Solution:
Create /root/renew_ssl.sh
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/certbot renew --standalone --pre-hook "service nginx stop" --post-hook "service nginx start"
chmod +x /root/renew_ssl.sh
cronjob -e
0 0 */2 * * /root/renew_ssl.sh >> log_renewssl.log
And now it works