voicepeak_api/manage_service.sh

20 lines
493 B
Bash
Raw Normal View History

2024-08-03 11:12:30 +00:00
#!/bin/bash
SERVICE_NAME="voicepeak-api.service"
# サービスの状態を確認
SERVICE_STATUS=$(systemctl is-active $SERVICE_NAME)
if [ "$SERVICE_STATUS" = "active" ]; then
echo "Restarting $SERVICE_NAME..."
sudo systemctl daemon-reload
sudo systemctl restart $SERVICE_NAME
else
echo "Reloading and starting $SERVICE_NAME..."
sudo systemctl daemon-reload
sudo systemctl start $SERVICE_NAME
fi
# サービスの状態を表示
sudo systemctl status $SERVICE_NAME