I’ve often written scripts only to discover once added to crontab that it relies on an environment setting such as having the java command in the PATH or having CVSROOT set. To avoid this I now run scripts I’m developing for cron with
to simulate the script running without an environment as follows:
This has greatly increased my success rate of adding a script to cron and having it work from the get go.
Pingback: Tagz | "Use env to ensure a script will work in cron" | Comments