I am trying to execute a script sitting on my remote server. This script activates a virtual environment and then executes some commands. Now I want to execute this script directly from my mac terminal. This is the content of the script
cd ~/workdir/
workon myvirtualenv
source ~/prodStuff/envVars
git pull origin master
supervisorctl -u admin -p password restart gunicorn
supervisorctl -u admin -p password status
deactivate
This script works fine when I login to the server and execute it. But when I try to execute the same from mac's terminal, it gives me the following error
/home/ubuntu/scripts/deploy_code.sh: line 2: workon: command not found
So essentially, I am unable to switch to virtual environment. This is the command I am using to execute the script from my terminal
ssh prodserver ". /home/ubuntu/scripts/deploy_code.sh"
I will appreciate if someone can help me resolve this.
Thanks