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