0

I think I have a problem with $PATH. I am running a shell script and it is complaining that it doesnt recognize the command even though when I run it manually it does.

Shell Script:

#!/bin/bash
# DEPLOYMENT

USR="test"
APP="/srv/www/test"
ENV="/srv/www/test/venv"
LOG="/var/log"

# LOGGING
exec > >(tee -a $LOG/log.log)
exec 2> >(tee -a $LOG/error.log)

# SOFTWARE
apt-get update
apt-get install -y python-dev build-essential nginx python-pip

# PACKAGES
pip install virtualenv uwsgi supervisor

# ENVIRONMENT
mkdir -p $APP
virtualenv $VENV
source $VENV/bin/activate

# FINALIZATION
service supervisor restart
service nginx restart

When I run this I get the following error:

Error Log:

/root/StackScript: line 22: virtualenv: command not found                                             
/root/StackScript: line 23: /bin/activate: No such file or directory                                  
supervisor: unrecognized service

When I run the command "pip" manually it says it is installed and recognized. What is happening and how can I diagnose this?

1

The problem appears to be that you have used VENV without defining it.

/root/StackScript: line 23: /bin/activate: No such file or directory

the $VENV is expanding to nothing so $VENV/bin/activate becomes /bin/activate and isn't found.

Perhaps you meant

VENV="/srv/www/test/venv"

at line 6.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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