#!/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