~改为使用守护进程启动

This commit is contained in:
juewuy
2025-12-09 15:14:37 +08:00
parent 1636fd21b9
commit 82e2da631f

View File

@@ -1,7 +1,7 @@
#!/sbin/openrc-run #!/sbin/openrc-run
# 服务名 # 服务名
name="ShellCrash" name="shellcrash"
description="Custom proxy service for ShellCrash" description="Custom proxy service for ShellCrash"
#获取目录 #获取目录
CRASHDIR=$(cat /etc/profile | grep CRASHDIR | awk -F "\"" '{print $2}') CRASHDIR=$(cat /etc/profile | grep CRASHDIR | awk -F "\"" '{print $2}')
@@ -40,13 +40,13 @@ start() {
return return
fi fi
# 启动主程序(后台进程 # 启动主程序(自动守护 + 自动重启
start-stop-daemon --start \ supervise-daemon "${name}" \
--background \
--make-pidfile \
--pidfile "${pidfile}" \ --pidfile "${pidfile}" \
--user "${runuser}" \ --user "${runuser}" \
--exec ${COMMAND%% *} -- ${COMMAND#* } --respawn-max 0 \
--respawn-delay 3 \
--start ${COMMAND%% *} -- ${COMMAND#* }
ret=$? ret=$?
eend $ret eend $ret