rsync的服务启动脚本

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


下一篇:头文件中的#ifndef/#define/#endif 的作用