Script does not execute completely.
by sysmicuser from LinuxQuestions.org on (#6E096)
Hi,
I have a shell script like below.
Code:cat sitecode_refresh.sh
#!/bin/bash
set -x
# Check if the vault password is provided
if [ -z "$1" ]; then
echo "Usage: $0 <password>"
exit 1
fi
scl enable python27 bash
pip2 install virtualenv=="16.7.10"
virtualenv -p /usr/bin/python2 sitecoderefresh
source sitecoderefresh/bin/activate
pip2 install -r requirements.txt
ansible-vault decrypt credential.json --vault-password-file <(echo "$1")
ansible-vault decrypt token.json --vault-password-file <(echo "$1")
python sitecode_refresh.py --spreadsheet_id="1abcxyz" --worksheet_name="Testing"
ansible-vault encrypt credential.json --vault-password-file <(echo "$1")
ansible-vault encrypt token.json --vault-password-file <(echo "$1")
deactivateHowever, when I execute the script, it executes only till bash and then stops it. Please find below the execution log.
Code:./sitecode_refresh.sh "EV:533nAI#"
+ '[' -z EV:533nAI# ']'
+ scl enable python27 bashCan someone please guide me so that script can be executed entirely?
I literally can copy and paste each command, and I assure you 100% it works not just in script :(
Perhaps my second question is, can I past this in any file so that pip is available for all users?
Code:scl enable python27 bash
Before scl command
Code:pip
bash: pip: command not found...
After scl command
Code:scl enable python27 bash
pip
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
type pip
pip is hashed (/opt/rh/python27/root/usr/bin/pip)
which pip
/opt/rh/python27/root/usr/bin/pipYour assistance is much appreciated.
I have a shell script like below.
Code:cat sitecode_refresh.sh
#!/bin/bash
set -x
# Check if the vault password is provided
if [ -z "$1" ]; then
echo "Usage: $0 <password>"
exit 1
fi
scl enable python27 bash
pip2 install virtualenv=="16.7.10"
virtualenv -p /usr/bin/python2 sitecoderefresh
source sitecoderefresh/bin/activate
pip2 install -r requirements.txt
ansible-vault decrypt credential.json --vault-password-file <(echo "$1")
ansible-vault decrypt token.json --vault-password-file <(echo "$1")
python sitecode_refresh.py --spreadsheet_id="1abcxyz" --worksheet_name="Testing"
ansible-vault encrypt credential.json --vault-password-file <(echo "$1")
ansible-vault encrypt token.json --vault-password-file <(echo "$1")
deactivateHowever, when I execute the script, it executes only till bash and then stops it. Please find below the execution log.
Code:./sitecode_refresh.sh "EV:533nAI#"
+ '[' -z EV:533nAI# ']'
+ scl enable python27 bashCan someone please guide me so that script can be executed entirely?
I literally can copy and paste each command, and I assure you 100% it works not just in script :(
Perhaps my second question is, can I past this in any file so that pip is available for all users?
Code:scl enable python27 bash
Before scl command
Code:pip
bash: pip: command not found...
After scl command
Code:scl enable python27 bash
pip
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
type pip
pip is hashed (/opt/rh/python27/root/usr/bin/pip)
which pip
/opt/rh/python27/root/usr/bin/pipYour assistance is much appreciated.