rija / docker-nginx-fpm-caches-wordpress

Wordpress (no DB server included) running with Nginx in a Docker container with caching and encryption enabled
Other
23 stars 7 forks source link

Error with crontab for renewing Let's Encrypt certificate /bin/sh: 1: nginx: not found #13

Closed rija closed 6 years ago

rija commented 6 years ago

The calls to nginx and service in the wordpress.cron cronjob fail because the default bash shell's environment variables are not accessible to cronjob. This is because cron doesn't use /bin/bash but /bin/sh which links to /bin/dash on Ubuntu.

The call to letsencrypt/certbot script in the same cronjob file succeeds because it is on the path known by /bin/sh.

The fix is to use absolute path for nginx and service, i.e: /usr/sbin/nginx and /usr/sbin/service.