1

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:

What am I missing?

  • Why the link to ubuntuforums? Are you saying that you solved the problem, and it was a non-unix style line ending? – Jos Jun 14 '16 at 10:22
  • @Jos updated question, it was a problem, but sadly not the fix – d3vid Jun 14 '16 at 10:30
  • Despite the wording 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, like echo $(date) >> /tmp/debugfile or something? – Jos Jun 14 '16 at 10:50
  • @Jos in fact, my first fix fixed it, but I forgot to chmod; I've reverted the question for clarity -- but thanks for the comment, it got me thinking! – d3vid Jun 14 '16 at 11:37
1

I created my-script on Windows, so the shebang was correct, but had a Windows line ending. This will cause a cron script to fail. Recreating the script on Ubuntu (and chmodding it etc) fixed the problem.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.