Change the current working directory when running run_me script
This commit is contained in:
parent
180545ea90
commit
d16ed82a89
15
run_me.sh
15
run_me.sh
@ -6,17 +6,18 @@
|
|||||||
# At each iteration, pull news from repository and update dependencies.
|
# At each iteration, pull news from repository and update dependencies.
|
||||||
|
|
||||||
# Get current directory
|
# Get current directory
|
||||||
this_script_directory=$(cd `dirname $0` && pwd)
|
this_script_directory=$(cd `dirname $0` && pwd);
|
||||||
|
cd "$this_script_directory";
|
||||||
|
|
||||||
# Import variables from my_config.sh
|
# Import variables from my_config.sh
|
||||||
# `$python_virtual_environment`: python virtual environment directory
|
# `$python_virtual_environment`: python virtual environment directory
|
||||||
# containing `python` and `pip`
|
# containing `python` and `pip`
|
||||||
# `$python_script`: complete path to python script to be run
|
# `$python_script`: complete path to python script to be run
|
||||||
source $this_script_directory/my_config.sh;
|
source "$this_script_directory/my_config.sh";
|
||||||
|
|
||||||
# Ensure the success of importing procedure:
|
# Ensure the success of importing procedure:
|
||||||
## variables of interest should be non-zero (`-z`)
|
## variables of interest should be non-zero (`-z`)
|
||||||
if [ -z ${python_virtual_environment} ];
|
if [ -z "${python_virtual_environment}" ];
|
||||||
then
|
then
|
||||||
printf "Please set in \"my_config.sh\" the path to bot python \
|
printf "Please set in \"my_config.sh\" the path to bot python \
|
||||||
virtual environment\n\
|
virtual environment\n\
|
||||||
@ -26,7 +27,7 @@ python_virtual_environment=\"path/to/virtual/env\"\n\
|
|||||||
";
|
";
|
||||||
exit;
|
exit;
|
||||||
fi
|
fi
|
||||||
if [ -z ${python_script} ];
|
if [ -z "${python_script}" ];
|
||||||
then
|
then
|
||||||
printf "Please set in \"my_config.sh\" the path to python script to be run \
|
printf "Please set in \"my_config.sh\" the path to python script to be run \
|
||||||
\n\
|
\n\
|
||||||
@ -34,7 +35,7 @@ Example:\n\
|
|||||||
python_script=\"path/to/python/script.py\"\n\
|
python_script=\"path/to/python/script.py\"\n\
|
||||||
";
|
";
|
||||||
exit;
|
exit;
|
||||||
elif [ ! -e ${python_script} ];
|
elif [ ! -e "${python_script}" ];
|
||||||
then
|
then
|
||||||
printf "File $python_script does not exist\n\
|
printf "File $python_script does not exist\n\
|
||||||
Please point to a valid file.\n\
|
Please point to a valid file.\n\
|
||||||
@ -50,9 +51,9 @@ do
|
|||||||
echo "Pulling from repository..."
|
echo "Pulling from repository..."
|
||||||
git pull;
|
git pull;
|
||||||
echo "Updating dependencies";
|
echo "Updating dependencies";
|
||||||
$python_virtual_environment/pip install --upgrade --no-cache-dir \
|
"$python_virtual_environment/pip" install --upgrade --no-cache-dir \
|
||||||
--no-deps davtelepot;
|
--no-deps davtelepot;
|
||||||
echo "Running python script";
|
echo "Running python script";
|
||||||
$python_virtual_environment/python -m ciclopibot.bot;
|
"$python_virtual_environment/python" -m ciclopibot.bot;
|
||||||
i=$?;
|
i=$?;
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user