I have a task defined in Supervisor that I would like to invoke hourly from /etc/cron.hourly
. I can run it manually, but not from run-parts
:
$ sudo supervisorctl start my-task
-- works
# . /etc/cron.hourly/my-script
-- works
$ sudo run-parts --report --test /etc/cron.hourly
-- lists my-script
as expected
$ sudo run-parts --report /etc/cron.hourly
-- fails with:
/etc/cron.hourly/my-script:
run-parts: failed to exec /etc/cron.hourly/my-script: No such file or directory
run-parts: /etc/cron.hourly/my-script exited with return code 1
The contents of /etc/cron.hourly/my-script
is:
#!/bin/sh
/usr/bin/supervisorctl start my-task
I have confirmed that:
- permission, filename and shebang of
my-script
are correct - I am using the full path to
supervisorctl
the cron script runs at 17 minutes past -- at which point
/var/log/syslog
reads:(root) CMD ( cd / && run-parts --report /etc/cron.hourly) Jun 14 10:17:01 DevAPps postfix/sendmail[16202]: fatal: open /etc/postfix/main.cf: No such file or directory
What am I missing?
failed to exec /etc/cron.hourly/my-script: No such file or directory
I think your script does get executed. Is there anything useful in the Supervisor log? Can you add some more debugging to your script, likeecho $(date) >> /tmp/debugfile
or something? – Jos Jun 14 '16 at 10:50