Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am having trouble setting up a cron job. My set up is as follows:

crontab -e

*/10 * * * * OTP_ProJect/PandaServerInfo/SVN/PandaQueueMonitoring/trunk/submit_cron_test.sh

the shell script has permissions:

-rwxr--r-- 1 submit_cron_test.sh

submit_cron_test.sh submits a python script:

python2.5 ProcessPlant.py --test

The error I am receiving is as follows:

/bin/sh: /OTP_ProJect/PandaServerInfo/SVN/PandaQueueMonitoring/trunk/submit_cron_test.sh: Permission denied

I have tried the command

/bin/sh /OTP_ProJect/PandaServerInfo/SVN/PandaQueueMonitoring/trunk/submit_cron_test.sh

and this works fine.

Has anyone got any ideas, because I have ran out. :-(

share|improve this question
1  
Path permissions? Who owns the file, and who owns the process that's trying to open it for execution? –  mpez0 Apr 19 '11 at 12:01
    
I am the owner of the file. The permission I have set is chmod u+x submit_cron_test.sh, but I am not the root user or have any admin privileges. the path permisions for /bin/sh has all users and groups rwx –  MWright Apr 19 '11 at 12:50
    
@MWright, the excerpt from the crontab file is "OTP_ProJect/..." WITHOUT a leading slash. –  glenn jackman Apr 19 '11 at 15:24
    
Your test of sh /OTP_ProJect/... does not test the executability of the script, only it's readability. Try it directly without the sh prefix. In particular, try the line exactly as it is in crontab. Also, the script is only executable by the file owner. I assume that that user is the same as the user who's crontab has the above entry. –  penguin359 Apr 19 '11 at 22:38
add comment

migrated from stackoverflow.com Apr 19 '11 at 13:33

This question came from our site for professional and enthusiast programmers.

1 Answer

Is submit_cron_test.sh owned by you? Only the owner can execute it directly. Prepending /bin/sh causes the sh command to read the script from the file, which any user can do.

You can do chmod a+x on the submit_cron_test.sh file.

Also does your script have a shebang (e.g. #!/bin/sh) line?

share|improve this answer
    
I am the owner of the file. The permission I have set is chmod u+x submit_cron_test.sh, but I am not the root user or have any admin privileges . I have the shebang set to #!/bin/zsh –  MWright Apr 19 '11 at 12:08
    
Hi, The server that I am working on doesn't have a token for cron jobs...so I have been told. Therefor I am getting the above error. I will move to a local machine to run my cron job. Cheers, Mike –  MWright Apr 19 '11 at 12:56
    
@MWright If this solved your problem you should accept it –  Michael Mrozek Apr 19 '11 at 18:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.