#!/bin/bash
#author:Mr.chen
# chkconfig:35 13 91
# description:This is Rsync service management shell script
# Source function library
. /etc/rc.d/init.d/functions
start(){
    rsync --daemon
    if [ $? -eq 0 -a `ps -ef|grep -v grep|grep rsync|wc -l` -gt 0 ];then
        action "Starting Rsync:" /bin/true
        sleep 1
    else
        action "Starting Rsync:" /bin/false
        sleep 1
    fi
}
stop(){
    pkill rsync;sleep 1;pkill rsync
    if [ `ps -ef|grep -v grep|grep "rsync --daemon"|wc -l` -lt 1 ];then
        action "Stopping Rsync: " /bin/true
        sleep 1
    else
        action "Stopping Rsync:" /bin/true
        sleep 1
    fi
}
case "$1" in
    start)
        start;
        ;;
    stop)
        stop;
        ;;
    restart|reload)
        stop;
        start;
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart|reload}"
        ;;
esac

 

相关文章:

  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2021-08-07
  • 2021-12-19
  • 2021-09-18
  • 2022-02-05
猜你喜欢
  • 2021-05-28
  • 2021-10-20
  • 2022-12-23
  • 2022-01-18
  • 2021-06-15
相关资源
相似解决方案