-->

Thursday, May 2, 2013

crontab tweakings


Remember to place a minimal configuration in your /etc/crontab or in your crontab -e


MAILTO=luca.marchesotti@gmail.com
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:~/bin



Exec format error (in cron)
If you are like me, you sometimes get lazy and forget to include the shell command at the top of your scripts. This usually isn't a problem, but in certain cases (where the shell isn't set, or doesn't exist yet) it will cause problems. So, even if your script is set to be executable (chmod +x), you'll receive an error like:

Exec format error


Just such a case manifests itself when using a script through cron (and run-parts). To remedy this problem put the following at the beginning of the script:

#!/bin/sh

Credit: 
Brian Oneill

No comments:

Post a Comment