cron job: permission denied

Posted on 2006-03-28
Medium Priority
Last Modified: 2010-04-22
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
Question by:paddyfitz2005

Expert Comment

ID: 16314377
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.

Author Comment

ID: 16314418
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

Accepted Solution

sheetbird earned 2000 total points
ID: 16314629
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
in the first line.  This tells the shell that it should be running the script under the Bourne shell.
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.


Author Comment

ID: 16314657
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 "").

Expert Comment

ID: 16314678
you need the full path for the java program  probably something like:
if you type in
which java
it will give you the full path
LVL 27

Expert Comment

ID: 16317915
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.
LVL 17

Expert Comment

by:Dushan De Silva
ID: 16331570
logon as "root" and do what ever the cron works.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question