Link to home
Start Free TrialLog in
Avatar of paddyfitz2005
paddyfitz2005

asked on

cron job: permission denied

hi
I'm having a problem running a cron job on my web hosing server
this is my script to run a java program
java -cp "appservers/jakarta-tomcat-5.5x/webapps/DBTest/WEB-INF/classes" Updater

but i get the following error
/bin/sh: line 1: /usr/ngasi/contexts/paddyfitz/script2.sh: Permission denied

Any Ideas
Avatar of sheetbird
sheetbird

Does this run successfully from the command line as the same uid as crontab owner?  

It looks like whatever happens on line one of script2.sh is causing the problem.  Can you post the first few lines of that script?

Also I always use fully qualified paths in the crontab since cron runs with a limited environment.
Avatar of paddyfitz2005

ASKER

this is all i have in my script!

java -cp "appservers/jakarta-tomcat-5.5x/webapps/DBTest/WEB-INF/classes" Updater

I'm new to crons and i know i have to define the java home dir but i can't find it on my web hosting server
ASKER CERTIFIED SOLUTION
Avatar of sheetbird
sheetbird

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok that makes sense nut i'm not sure what you mean by

>>replace java with whatever you system returns with the "which java" command (no "").
you need the full path for the java program  probably something like:
/usr/local/jdk/bin/java
if you type in
which java
it will give you the full path
Avatar of Arty K
paddyfitz2005,
1) add #!/bin/sh as a first line of your script
2) give your script execution priveledges:
chmod +x /usr/ngasi/contexts/paddyfitz/script2.sh

this should help.
logon as "root" and do what ever the cron works.