Crontab not executing bash script
bash, cron, shell
Solution
Remove the .sh extension from the script in `/etc/cron.d` and it will be called.
`run-parts` ignores files with a period in the name, so the .sh extension is preventing your script from running.
From `man cron` -
Files must conform to the same naming convention as used by run-parts(8): they must consist solely of upper- and lower-case letters, digits, underscores, and hyphens.
Problem
I very very rarely use Linux and so don't have any experience with bash scripts and cron jobs. This is in fact my first attempt. So it's probably something really simple to fix. I have the following: /etc/cron.d/clear-mixtape-dir.sh permissions are: 644 ``` #!/bin/bash # Clears the /tmp/mixtape2 directory rm -rf "/tmp/mixtape2/"* ``` My crontab file looks like so: ``` SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ */15 * * * * /etc/cron.d/clear-mixtape-dir.sh >/dev/null 2>&1 ``` I'm trying to execute the .sh script every 15 minutes. Everything i've found says this should work, but it doesn't. Does anything like file permissions (on files within /tmp/mixtape2/) matter in this case? Or perhaps the permissions set on the actual .sh script - maybe they need setting to executable? Any advice appreciated.