Schafkopf-Server/build.sh

32 lines
550 B
Bash
Raw Normal View History

2023-09-07 17:37:30 +02:00
supervisor_name=schafkopf
2023-09-07 16:10:27 +02:00
echo "[1/7] Stopping server..."
2023-09-07 17:37:30 +02:00
sudo supervisorctl stop supervisor_name
2023-09-07 16:10:27 +02:00
echo "[2/7] Changing permissions..."
2023-09-07 17:37:30 +02:00
if ! sudo chown -R pi:pi .; then
exit 0
fi
2023-09-07 16:10:27 +02:00
echo "[3/7] Pulling changes..."
2023-09-07 17:37:30 +02:00
if ! git pull; then
exit 0
fi
2023-09-07 16:10:27 +02:00
echo "[4/7] Building project..."
2023-09-07 17:37:30 +02:00
if ! swift build -c release; then
exit 0
fi
2023-09-07 16:10:27 +02:00
echo "[5/7] Restoring permissions..."
2023-09-07 17:37:30 +02:00
if ! sudo chown -R www-data:www-data .; then
exit 0
fi
2023-09-07 16:10:27 +02:00
echo "[6/7] Starting server..."
2023-09-07 17:37:30 +02:00
if ! sudo supervisorctl start $supervisor_name; then
exit 0
fi
2023-09-07 16:10:27 +02:00
echo "[7/7] Done"