Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
-rw-r--r--. 1 myusername developers 169 May 17 09:01

Why is it I can execute the script from the command line if it does not have execute permissions but when crontab tries to execute it, it fails?

share|improve this question
how are you executing it from the command line ? – Iain May 23 '12 at 8:05
You can execute a script even if it does not have execute permission using sh or bash – Khaled May 23 '12 at 8:27
up vote 5 down vote accepted

You can't execute that from the command line, because it doesn't have execute permissions.

What you can do, is to source it from the command line,

. ./

which causes the current shell to execute the commands in the file as if they were being typed on the command line.

You can't do this from cron, so you'll need to give the script execute permissions (chmod 744

You can also 'run' scripts by executing a shell and passing the script to it, such as,


This is because you're executing sh (which has the +x permission), and it is reading the file and running the commands as if they were typed on the command line, before exiting.

share|improve this answer

Your Answer


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.