This is a tiny Cron Job workaround for certbot nginx issue related in this thread.
Create and configure manually the certificates at nginx using certonly
certbot method; then just set a custom Cron Job using this script.
Clone, create or copy the content of this repo in you server.
/path_to_file/crontab
- Cron command task/path_to_file/renewssl.sh
- Cron Job task/path_to_file/renewssl.logs
- Cron logging file
At crontab
file properly configure the path to the files path_to_file
.
0 0 1 * * /`path_to_file`/renewssl.sh >> /`path_to_file`/renewssl.logs 2>&1
This taks will run every month 0 0 1 * *
, you can set it as you want.
Assign execute permission to renewssl.sh
.
chmod +x /path_to_file/renewssl.sh
Set configuration vars at renewssl.sh
.
WEB_SERVICE="nginx"
EMAIL_CERTBOT="[email protected]"
DOMAINS_CERTBOT="-d domain1.com -d domain2.com -d domain3.com"
PORT="80"
Setup crontab taks
crontab /path_to_file/crontab
You can edit it using crontab -e
.
If you have followed above steps correctly, your cronjob should be ready :)
If you want to test if your cron job is working just follow this steps:
Run manually bash script to test it:
bash /path_to_file/renewssl.sh
Update your crontab schedule to run every minute * * * * *
. Open and edit your crontab with: crontab -e
:
* * * * * /`path_to_file`/renewssl.sh >> /`path_to_file`/renewssl.logs 2>&1
Just follow the logging file:
tail /path_to_file/renewssl.logs -f
The output should looks like this:
If everything is fine setup back your crontab schedule (crontab -e
).
Happy coding!