最新消息:其实接手服务器,最最最重要的还是要看下数据库、文件备份情况!!!非常重要!!!

rsync启动脚本

application shang 1470浏览 0评论

说明:
rsync自启动脚本,非常好用,虽然还看不太懂!!!比如killproc,系统命令就没有
 

#!/bin/bash
#
# rsyncd      This shell script takes care of starting and stopping
#             standalone rsync.
#
# chkconfig: - 99 50
# description: rsync is a file transport daemon
# processname: rsync
# config: /etc/rsyncd.conf

# Source function library
. /etc/rc.d/init.d/functions

RETVAL=0
rsync="/usr/bin/rsync"
prog="rsync"
CFILE="/etc/rsyncd.conf"

start() {
        # Start daemons.
        [ -x $rsync ] || \
            { echo "FATAL: No such programme";exit 4; }
        [ -f $CFILE ] || \
            { echo "FATAL: config file does not exist";exit 6; }
        echo -n $"Starting $prog: "
        daemon $rsync --daemon --config=$CFILE
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        echo
        return $RETVAL
}

stop() {
        # Stop daemons.
        echo -n $"Stopping $prog: "
        killproc $prog -QUIT
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
        return $RETVAL
}

# call the function we defined
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        start
        RETVAL=$?
        ;;
  status)
        status $prog
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 2
esac

exit $RETVAL

转载请注明:酷喃|coolnull| » rsync启动脚本

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址