歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> CentOS 6.8上使用start-stop-daemon命令

CentOS 6.8上使用start-stop-daemon命令

日期:2017/3/3 17:46:22   编辑:學習Linux

CentOS 6.8上使用start-stop-daemon命令

CentOS 6.8上使用start-stop-daemon命令


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

  • 下載dpkg_1.16.18.tar.xz鏈接:http://ftp.de.debian.org/debian/pool/main/d/dpkg,服務器下載比較慢,建議本地下載完成上傳到服務器上,編譯安裝如下:
wget http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_1.16.18.tar.xztar -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 && makefind / -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/shDESC="Jenkins CI Server"NAME=jenkinsPIDFILE=/var/run/$NAME.pidRUN_AS=jenkinsCOMMAND="/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    ;;esacexit 0

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

http://xxxxxx/Linuxjc/1184743.html TechArticle

Copyright © Linux教程網 All Rights Reserved