I often have errors where running a command from cron wasn't the same as running it from the command line. This is a small/silly attempt to remove those descrepencies and be able to just copy and paste what was in cron and expect that is the same.
I just put cronrun in /usr/local/bin and set it executable, and then set PATH in my crontab to include /usr/local/bin.
cronrun basically does:
-
set any environment i want (add ~/bin to path)
-
support '--logname=yourlog.log' and redirect output there so you don't have to read
mail
-
support
--logname=foo-YYYYMMDD.log
replacing with current date. -
execute the command provided.
$ crontab -l PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 03 0-23/2 * * * cronrun --quiet --logname=my-command.log my-command my-args