shell script not running via crontab, runs fine manually shell script not running via crontab, runs fine manually shell shell

shell script not running via crontab, runs fine manually


Try specifying the full path to the jar file:

/usr/bin/java -jar /path/to/Pharmagistics_auto.jar -o


I would just tell you what you have already ruled out: Check your path and environment.

Since you have alredy done this, start debugging. Like write checkpoints into a logfile to see how far your script gets (if even started at all), check the cronjob log file for errors, check your mail (cron sends mails on errors) and so on ...

Not very specific, sorry.


"exporting my paths and variables" won't work since crontab runs in a different shell by a different user.

Also, not sure if this is a typo in how you entered the question, but I see:

usr/bin/java

...and I can't help but notice you're not specifying the fully qualified path. It's looking for a directory named "usr" in the current working directory. Oft times for crontab, the cwd is undefined, hence your reference goes nowhere.

Try specifying the full path from root, like so:

/usr/bin/java

Or, if you want to see an example of relative pathing in action, you could also try:

cd /

usr/bin/java