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
paddyfitz2005Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sheetbirdCommented:
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.
paddyfitz2005Author Commented:
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
sheetbirdCommented:
OK now I assume  your crontab has something like

0 12 * * * /usr/ngasi/contexts/paddyfitz/script2.sh

And then /usr/ngasi/contexts/paddyfitz/script2.sh has:

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

replace java with whatever you system returns with the "which java" command (no "").  Also fully qualify your classpath as well like /usr/local/appservers/jakarta-tomcat-5.5x/webapps/DBTest/WEB-INF/classes

also in /usr/ngasi/contexts/paddyfitz/script2.sh put
#!/bin/sh
in the first line.  This tells the shell that it should be running the script under the Bourne shell.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

paddyfitz2005Author Commented:
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 "").
sheetbirdCommented:
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
Artysystem administratorCommented:
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.
Dushan De SilvaTechnology ArchitectCommented:
logon as "root" and do what ever the cron works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.