-rw-r--r--. 1 myusername developers 169 May 17 09:01 build.sh
Why is it I can execute the build.sh script from the command line if it does not have execute permissions but when crontab tries to execute it, it fails?
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 build.sh).
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
build.sh and running the commands as if they were typed on the command line, before exiting.
- How do you give execute permissions to Apache2 user and NOT to everyone else?
- Set windows permissions to allow modify, but not execute
- Where is the Execute Permissions function in IIS7
- What is the proper way to grant stored proc execute permissions for a SQL Server user?
- execute bash on local machine to do work on remote?