Cron daemon error : Permission Denied

5,482

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:
5,482

Related videos on Youtube

MWright
Author by

MWright

Updated on September 18, 2022

Comments

  • MWright
    MWright over 1 year

    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. :-(

    • Admin
      Admin about 13 years
      Path permissions? Who owns the file, and who owns the process that's trying to open it for execution?
    • Admin
      Admin about 13 years
      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
    • Angel Todorov
      Angel Todorov about 13 years
      @MWright, the excerpt from the crontab file is "OTP_ProJect/..." WITHOUT a leading slash.
    • penguin359
      penguin359 about 13 years
      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.
  • teratux
    teratux about 13 years
    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
  • teratux
    teratux about 13 years
    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
  • Michael Mrozek
    Michael Mrozek about 13 years
    @MWright If this solved your problem you should accept it