start-stop-daemon简介 start-stop-daemon是一个Debian体系里的一个守护进程管理软件,可以用指定的用户启停软件。 start-stop-daemon 使用:http://man7.org/linux/man-pages/man8/start-stop-daemon.8.html start-stop-daemon /configure && make find / -name start-stop-daemon # 查看start-stop-daemon位置 start-stop-daemon使用 cp /usr /local/src/dpkg-1.16.18/utils/start-stop-daemon /usr/local/sbin/ ################################### $NAME.pid RUN_AS=jenkins COMMAND="/usr/bin/java -- -jar /home/jenkins/jenkins.war" d_start() { start-stop-daemon
test -x $DAEMON || exit 0 set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon -- $DAEMON_OPTS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon -K --quiet --pidfile $PID \ --name $NAME sleep 1 start-stop-daemon - DAEMON_OPTS echo "$NAME." ;; reload) echo -n "Reloading $DESC configuration: " start-stop-daemon
0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon /etc/default/nginx fi set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon -- $DAEMON_OPTS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon -stop --quiet --pidfile \ /var/run/nginx.pid --exec $DAEMON sleep 1 start-stop-daemon
相关参考资料: http://man.cx/start-stop-daemon(8) http://cronolog.org/usage.html http://book.opensourceproject.org.cn | exit 0 set -e export PIDFILE=/var/run/${NAME}.pid case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon # directly anyway, make this a do-nothing entry. # # echo "Reloading $DESC configuration files." # start-stop-daemon If not, "force-reload" is # just the same as "restart". # echo -n "Restarting $DESC: " start-stop-daemon --stop --pidfile ${PIDFILE} # --exec $DAEMON sleep 1 start-stop-daemon --start --make-pidfile --pidfile
daemon has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON [ "$?" # start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME return 0 } case "$1
Ignoring $PIDFILE" fi start-stop-daemon --start --pidfile "$PIDFILE" "$NAME" if start-stop-daemon --quiet --test --start --pidfile "$PIDFILE" \ - fi else start-stop-daemon --quiet --stop \ --pidfile start-stop-daemon --quiet --test --start \ --pidfile "$PIDFILE" --user "$ "$NAME" log_end_msg 0 fi ;; status) if start-stop-daemon
比如在Ubuntu下我们可以使用start-stop-daemon这个小程序轻松将你的程序转换为Daemon: $> start-stop-daemon –start –pidfile . /signal.pid –startas /home/tonybai/test/go/signal –background -m $> start-stop-daemon –stop –pidfile start-stop-daemon在Debian系的Linux发行版中都是默认自带的。 apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz cd apps/sys-utils/start-stop-daemon-IR1_9_18-2 gcc start-stop-daemon.c -o start-stop-daemon 切换到root下 cp start-stop-daemon /sbin/ chmod +x /sbin/start-stop-daemon 另外Go 1.0.2提供的二进制安装包直接在Redhat 5.6
/bin/sh # Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh set -e # Must be a valid consul -ui -log-file=/var/log/$NAME" case "$1" in start) echo -n "Starting daemon: "$NAME start-stop-daemon DAEMON -- $DAEMON_ARGS echo "." ;; stop) echo -n "Stopping daemon: "$NAME start-stop-daemon -pidfile $PIDFILE echo "." ;; restart) echo -n "Restarting daemon: "$NAME start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE start-stop-daemon --start --background --make-pidfile
0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start --quiet --pidfile $PID --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon HUP --quiet --pidfile $PID --name $NAME return 0 } rotate_logs() { # Rotate log files start-stop-daemon
has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON [ "$?" # start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME return 0 }
. ### END INIT INFO case "$1" in start) start-stop-daemon --start --background --exec /root/proxy.py ;; stop) start-stop-daemon --stop --name proxy.py esac 到此,一个最简单的随机启动服务写好了,看起来文章挺长的,但其实也就几个命令而已。
fi fi printf "Starting dropbear sshd: " umask 077 start-stop-daemon = 0 ] && echo "OK" || echo "FAIL" } stop() { printf "Stopping dropbear sshd: " start-stop-daemon
Preconfiguring packages ... dpkg: warning: 'ldconfig' not found in PATH or not executable. dpkg: warning: 'start-stop-daemon
DAEMON_LOG}" chmod u+rw "${DAEMON_LOG}" if [ -z "${DAEMON_USER}" ]; then start-stop-daemon else start-stop-daemon --start --quiet --oknodo --background \ --nicelevel
# Short-Description: starts the nodekeeper web server # Description: starts nodekeeper using start-stop-daemon # fi #} case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet --pidfile \ --exec $DAEMON -- $DAEMON_OPTS || true echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --exec $DAEMON || true echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --pidfile \ /var/run/$NAME.pid --exec $DAEMON || true sleep 1 start-stop-daemon
0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon
用法:dpkg-statoverride [选项] start-stop-daemon: 功能:start-stop-daemon是一个通用的守护进程管理器,用于启动、停止、重启系统服务。 用法: 启动服务:start-stop-daemon --start --name <服务名> 停止服务:start-stop-daemon --stop --name <服务名> 重启服务 :start-stop-daemon --restart --name <服务名> dpkg 使用手册 安装: 安装软件包:dpkg -i package-name.deb (–install)必须使用完整的
6 # Short-Description: starts the php_fastcgi daemon # Description: starts php_fastcgi using start-stop-daemon
pve-cluster不可启动 ipcc_send_rec failed: Connection refused 查看'/etc/init.d/pve-cluster'中的'start_server()' # 'start-stop-daemon
if [ $USE_START_STOP_DAEMON = true ] && type start-stop-daemon > /dev/null 2>&1; then start-stop-daemon