首页 > 其他 > 详细

rsync daemon控制脚本

时间:2014-02-19 11:15:47      阅读:346      评论:0      收藏:0      [点我收藏+]
#!/bin/sh
# rsync boot file
# write by : r.tang
# mailto : bashrc@163.com
[ -f /etc/init.d/functions ] && . /etc/init.d/functions
# basedir=$(dirname $(which rsync))
basedir=/usr/bin
pidfile=/var/run/rsyncd.pid
function DoAction()
{
    [ $? -eq 0 ] &&     action "$doAct" /bin/true ||     action "$doAct" /bin/false
}
function start()
{
    doAct="Starting Rsync Daemon    "
    [ -e $pidfile ]  || $basedir/rsync --daemon
    DoAction
      
}
function stop()
{
    doAct="Stoping Rsync Daemon"
    [ -e $pidfile ] && kill -9 $(cat $pidfile) && rm -f $pidfile
    DoAction
}
function status()
{
    [ -e $pidfile ] &&     echo "Rsync is Running [ $(cat $pidfile) ]" ||     echo "Rsync is Stopped"
}
case $1 in
start)
    start
    ;;
stop)
    stop
    ;;
restart)
    stop && sleep 2
    start
    ;;
status)
    status
    ;;
*)
    echo "Usage: $0 [start|stop|restart|status]"
    ;;
esac


本文出自 “bashrc的博客” 博客,请务必保留此出处http://bashrc.blog.51cto.com/7339808/1360161

rsync daemon控制脚本

原文:http://bashrc.blog.51cto.com/7339808/1360161

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