服务端 1 #!/bin/sh 2 # chkconfig: 2345 21 60 3 # description: Saves and restores system entropy pool for \ 4 #create by xiaohu 5 #2014.06.02 ...
服务端
1 #!/bin/sh 2 # chkconfig: 2345 21 60 3 # description: Saves and restores system entropy pool for \ 4 #create by xiaohu 5 #2014.06.02 6 #This script is the Rsync service script 7 . /etc/init.d/functions 8 case "$1" in 9 start)10 echo "rsync is starting"11 /usr/local/rsyncd/bin/rsync --daemon --config=/etc/rsyncd.conf12 sleep 213 myport=`netstat -lnt|grep 873|wc -l`14 if [ $myport -eq 2 ]15 then16 action "rsync start" /bin/true17 else18 action "rsync start" /bin/false19 fi20 ;;21 stop)22 echo "rsync is stoping"23 myport=`netstat -lnt|grep 873|wc -l`24 if [ $myport -eq 2 ]25 then 26 killall rsync &>/dev/null27 sleep 228 killall rsync &>/dev/null29 sleep 130 fi31 myport=`netstat -lnt|grep 873|wc -l`32 if [ $myport -ne 2 ]33 then34 action "rsync stop" /bin/true35 else36 action "rsync stop" /bin/false37 fi38 ;;39 restart)40 if [ `netstat -lnt|grep 873|wc -l` -eq 0 ]41 then42 /usr/local/rsyncd/bin/rsync --daemon --config=/etc/rsyncd.conf43 sleep 244 myport=`netstat -lnt|grep 873|wc -l`45 if [ $myport -eq 2 ]46 then47 action "rsync restart" /bin/true48 else49 action "rsync restart" /bin/false50 exit51 fi52 else53 killall rsync &>/dev/null54 sleep 255 killall rsync &>/dev/null56 sleep 157 /usr/local/rsyncd/bin/rsync --daemon --config=/etc/rsyncd.conf58 sleep 259 myport=`netstat -lnt|grep 873|wc -l`60 if [ $myport -eq 2 ]61 then62 action "rsync restart" /bin/true63 else64 action "rsync restart" /bin/false65 fi66 fi67 ;;68 status)69 myport=`netstat -lnt|grep 873|wc -l`70 if [ $myport -eq 2 ]71 then72 echo "rsync is running"73 else74 echo "rsync is stoped"75 fi76 ;;77 *)78 echo $"Usage: $0 {start|stop|status|restart}"79 ;;80 esac
原标题:rsync随机启动脚本
关键词:随机
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。