有没有人使用start-stop-daemon和mono-service2一起成功?我已经和它斗争了几天了,已经有了各种各样的工作,但是没有成功为单声道服务获得一个功能齐全的init脚本.
这是我迄今所学到的:
单声道或单声道服务exe必须命名为变量DAEMON(您不能将您的exe列为DAEMON)
您必须使用--background标志...否则,当从包安装程序执行此脚本时(在我的情况下为deb).安装程序结束时服务终止(与安装程序分叉处理的方式有关...我没有对此进行过多次调查).
我已经成功地在其他脚本中使用mono-service标志列出了pid文件并使用它来停止守护进程,但由于某种原因它在这里不起作用.因此,下面的脚本不会停止服务 - 不知道为什么.开始工作正常.
这是我的部分功能初始化脚本:
#! /bin/sh
### BEGIN INIT INFO
# Provides: ServiceName
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts and Stops Service
# Description: Service start|stop|restart
### END INIT INFO
# Author: Author
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Description of the service"
NAME=Service.exe
DAEMONNAME=ServiceDaemon.sh
INSTALLDIR=/usr/sbin/ …
Run Code Online (Sandbox Code Playgroud)