首页 > 其他 > 详细

rsync启动脚本

时间:2017-08-31 10:53:55      阅读:238      评论:0      收藏:0      [点我收藏+]

#!/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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!