Daemon: set -e
This commit is contained in:
parent
df0b656f94
commit
d2499f8f3f
23
run.sh
23
run.sh
@ -3,20 +3,19 @@ delay=900
|
|||||||
version_file=/etc/lixonet/version
|
version_file=/etc/lixonet/version
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
{
|
(
|
||||||
current_version=`cat $version_file || echo 0` &&
|
set -e
|
||||||
git fetch &&
|
current_version=`cat $version_file || echo 0`
|
||||||
latest_commit=`git log "--format=%G? %H" | grep ^G | head -n 1 | cut -d' ' -f2` &&
|
git fetch
|
||||||
git checkout $latest_commit &&
|
latest_commit=`git log "--format=%G? %H" | grep ^G | head -n 1 | cut -d' ' -f2`
|
||||||
checkout_version=`cat version` &&
|
git checkout $latest_commit
|
||||||
|
checkout_version=`cat version`
|
||||||
if [ "$checkout_version" -gt "$current_version" ]; then
|
if [ "$checkout_version" -gt "$current_version" ]; then
|
||||||
echo "Updating to version $checkout_version..." &&
|
echo "Updating to version $checkout_version..."
|
||||||
chmod +x build.sh && ./build.sh &&
|
chmod +x build.sh && ./build.sh
|
||||||
echo "Updated to version $checkout_version." &&
|
echo "Updated to version $checkout_version."
|
||||||
echo $checkout_version > $version_file
|
echo $checkout_version > $version_file
|
||||||
fi
|
fi
|
||||||
} || {
|
)
|
||||||
echo "Failed to update repository. Trying again in $delay seconds."
|
|
||||||
}
|
|
||||||
sleep $delay
|
sleep $delay
|
||||||
done
|
done
|
Loading…
x
Reference in New Issue
Block a user