前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 6.8 使用start-stop-daemon命令

CentOS 6.8 使用start-stop-daemon命令

作者头像
shaonbean
发布2019-05-26 19:53:17
2.6K0
发布2019-05-26 19:53:17
举报
文章被收录于专栏:运维前线运维前线运维前线

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 安装

wget http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_1.16.18.tar.xz
tar -xf dpkg_1.16.18.tar.xz && cd dpkg_1.16.18
./configure
# configure: error: no curses library found 
yum install ncurses-devel -y
./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/

#######################################################################
#!/bin/sh

DESC="Jenkins CI Server"
NAME=jenkins
PIDFILE=/var/run/$NAME.pid
RUN_AS=jenkins
COMMAND="/usr/bin/java -- -jar /home/jenkins/jenkins.war"

d_start() {
    start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --chuid $RUN_AS --exec $COMMAND
}

d_stop() {
    start-stop-daemon --stop --quiet --pidfile $PIDFILE
    if [ -e $PIDFILE ]
        then rm $PIDFILE
    fi
}

case $1 in
    start)
    echo -n "Starting $DESC: $NAME"
    d_start
    echo "."
    ;;
    stop)
    echo -n "Stopping $DESC: $NAME"
    d_stop
    echo "."
    ;;
    restart)
    echo -n "Restarting $DESC: $NAME"
    d_stop
    sleep 1
    d_start
    echo "."
    ;;
    *)
    echo "usage: $NAME {start|stop|restart}"
    exit 1
    ;;
esac

exit 0

参考:http://blog.csdn.net/wangjianno2/article/details/52080299

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年12月08日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • start-stop-daemon简介
  • start-stop-daemon 安装
  • start-stop-daemon使用
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档