I needed to run a script (let's say my-script.sh) on a hourly base and debian distribution provides an easy way to achieve this. We have to store it in the following folder to start it regularly:
/etc/cron.hourly
It was a simple shell script, beginning with :
#!/bin/sh
But... no execution. The logging is poor and I had trouble to solve this issue.
Here are the steps ... and the resolution:
When adding a job to /etc/cron.hourly ( or .daily, .weekly, etc), always test afterwards that run-parts will actually run it by issuing the command:
run-parts --test /etc/cron.hourly
To know more, RTFM about run-parts will give you interesting information:
man run-parts
But, after digging, I could identify the problem:
giving your script an extension will make it invalid and result in the job not being run. This because the only allowed characters are [a-zA-Z0-9_-]