Skip to content

Instantly share code, notes, and snippets.

@TurBoss
Last active July 23, 2017 09:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TurBoss/2ad90f76297515696d0ee997413799f9 to your computer and use it in GitHub Desktop.
Save TurBoss/2ad90f76297515696d0ee997413799f9 to your computer and use it in GitHub Desktop.
#!/bin/bash
#branches develop release
BRANCH="develop"
date=$(date)
OUTPUT=$(python /home/spring/scripts/upq.py)
VERSION=$(echo "$OUTPUT" | cut -d' ' -f1)
# BRANCH2=$(echo "$OUTPUT" | cut -d' ' -f2)
echo "$OUTPUT"
echo "$date"
echo "$BRANCH"
echo "$VERSION"
file="/home/spring/log/latestEngine"
latest=$(cat $file)
spadsCfg="/home/spring/spads-develop/etc/spads.conf"
if [ "$VERSION" != "$latest" ]
then
echo "$date"
echo "NEW VERSION FOUND"
#Stop running instance
sudo systemctl stop spads-develop.service
#Get lastest engine version
cd /home/spring/ || return
pr-downloader --download-engine "$OUTPUT" # > /dev/null 2>&1
rm "/home/spring/.spring/engine/spring_{develop}%s_minimal-portable-linux64-static.7z" "$VERSION"
#configure spads
cd /home/spring/spads-develop || return
sed -i "s/^\(springServer\:\).*\$/\1\/home\/spring\/\.spring\/engine\/$OUTPUT\/spring-dedicated/" $spadsCfg
sleep 10
printf "/home/spring/.spring/engine/%s/libunitsync.so\n\n\n" "$OUTPUT" | ./spadsInstaller.pl -g # > /dev/null 2>&1
echo "$VERSION" > /home/spring/log/latestEngine
#Start a new instance
sudo systemctl start spads-develop.service
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment