30 lines
847 B
Bash
30 lines
847 B
Bash
#!/bin/bash
|
|
|
|
# This file must be executable, otherwise the service cannot run it.
|
|
# Run `$python_script` while exit code is 65.
|
|
# At each iteration, pull news from repository and update dependencies.
|
|
|
|
# Get current directory
|
|
this_script_directory=$(cd `dirname $0` && pwd);
|
|
cd "$this_script_directory";
|
|
|
|
if [ ! -d "$this_script_directory/env" ]; then
|
|
python3 -m venv env;
|
|
env/bin/pip install -r requirements.txt;
|
|
fi
|
|
|
|
python_virtual_environment="$this_script_directory/env/bin"
|
|
echo "Python script will be run while it exits with value===65.";
|
|
i=65;
|
|
while [ $i -eq 65 ]
|
|
do
|
|
echo "Pulling from repository..."
|
|
git pull;
|
|
echo "Updating dependencies";
|
|
"$python_virtual_environment/pip" install --upgrade --no-cache-dir \
|
|
--no-deps davtelepot;
|
|
echo "Running python script";
|
|
"$python_virtual_environment/python" -m bic_bot;
|
|
i=$?;
|
|
done
|