Forums

Can't get shell script to execute: permission denied

I'm trying to execute a simple python script, but it appears I need to activate a virtual env first to make sure it's able to import all its modules. I created a shell script called runAll.sh that does the following:

**

source /path/.virtualenvs/path/bin/virtualenvwrapper.sh

workon (name of virtualenv)

python runBots.py

**

When I run this in a bash shell using:

bash runAll.sh

it works just fine. However when I try to create a scheduled task using the following

/path/path/runAll.sh

I'm getting the error 'permission denied'

I tried killing any running bash consoles but that didn't help. Am I approaching this problem the right way? What am I missing?

Is it because you need to use a full path for runBots.py? Try to figure out which line is giving the permission denied error.

Also, you probably need to make runAll.sh executable. If you can run runAll.sh from the command-line using ./runAll.sh instead of bash runAll.sh then it's executable.

Looks like you were both right! The "permission denied" error came because I didn't have ability to run the shell script.

The way to do that is, from a terminal, run:

chmod +x runAll.sh

Then it gave me the error "can't find file" and I fixed that by changing the last line in my shell script to:

python /path/path/runBots.py

Thanks so much both of you for your help!