Fortnightly cron job
I need to put a fortnightly job into roots cron and are using the following syntax.
/usr/bin/expr `/usr/bin/date +%W` % 2 >/dev/null || /opt/SonicSoftware/SonicMQ/bin/ss.sh
and
/usr/bin/expr `/usr/bin/date +%W` % 2 >/dev/null && /opt/SonicSoftware/SonicMQ/bin/ss1.sh || true
when I run it from the command line it works fine but it fails when trying to execute from cron
Any ideas ?
[441 byte] By [
sspriggs] at [2007-11-25 23:17:27]

# 1
My first guess would be environment variable related. When you run from the command line, the environment variables for the user running the program are used. cron does not import environment variables, so I would make sure that the script(s) you are running have all needed environment settings, including PATH statements included directly in the script, or make sure that the script is sourcing a file with the appropriate variables.
# 2
All my crontab entries with a % have the % escaped, so I think for crontab this is required?At any rate, try changing % to \% , and see what that does ..........