首页 > 其他 > 详细

rsync chkconfig scripts

时间:2018-03-13 10:53:38      阅读:210      评论:0      收藏:0      [点我收藏+]
if [ $# -ne 1 ];then
#! /bin/bash
#chkconfig 2345 30 60
#This scripts is sync

if [ $# -ne 1 ];then
echo $"usage:$0 {start|stop|restart}"
exit 1
fi
if [ $1 = "start" ];then
sync --dameon
sleep 2
if [ netstat -tnlup | grep rsync | wc -l -ge 1 ];then
echo "The sync services starting.."
exit 0
fi
elif [ $1 = "stop" ];then
killall rsync &> /dev/null
sleep 1
if [ netstat -tnlup | grep rsync | wc -l -eq 0 ];then
echo "The sync services stopping.."
exit 0
fi
elif [ $1 = "restart" ];then
killall rsync
sleep 1
if [ netstat -tnlup | grep rsync | wc -l -eq 0 ];then
k1=1
echo "The rsync services stopping.."
fi
sync --dameon
sleep 2
if [ netstat -tnlup | grep rsync | wc -l -ge 1 ];then
s1=1
echo "The sync services starting.."
fi
if [ $k1 -eq 1 -a $s1 -eq 1 ];then
echo "The rsync service restart ..."
exit 0
fi
else
echo "please input right arguments..."
fi

rsync chkconfig scripts

原文:http://blog.51cto.com/546136/2085873

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