mihomo_studio/S95mihomo-web
2025-11-24 16:23:47 +03:00

34 lines
698 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
PROG=/opt/scripts/mihomo_editor.py
PIDfile=/opt/var/run/mihomo_editor.pid
case "$1" in
start)
echo "Starting Mihomo Web Editor..."
# Запуск python в фоне
python3 $PROG > /dev/null 2>&1 &
echo $! > $PIDfile
;;
stop)
echo "Stopping Mihomo Web Editor..."
if [ -f $PIDfile ]; then
kill $(cat $PIDfile)
rm $PIDfile
else
echo "No PID file found."
# На всякий случай убиваем по имени, если PID потерян
pkill -f "python3 $PROG"
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0