标签:rsync启动脚本
#!/bin/sh
#chkconfig: 2345 20 80
#description: create by bai
. /etc/init.d/functions
judge=`netstat -lntup|grep rsync|wc -l`
_start(){
if [ $judge -eq 2 ]
then
action "rsync is running" /bin/true
else
rsync --daemon
sleep 1
action "rsync started" /bin/true
fi
}
_stop(){
if [ `netstat -lntup|grep rsync|wc -l` -ge 0 ]
then
killall rsync >/dev/null 2>&1
sleep 3
if [ `netstat -lntup|grep rsync|wc -l` -eq 0 ]
then
action "rsync is stopped" /bin/true
fi
else
action "rsync is stopped" /bin/true
fi
}
case "$1" in
start)
_start
;;
stop)
_stop
;;
restart)
_stop
sleep 2
_start
;;
*)
echo $"usage:$0 {start|stop|restart}"
;;
esac
本文出自 “10997527” 博客,谢绝转载!
标签:rsync启动脚本
原文地址:http://11007527.blog.51cto.com/10997527/1961301