rsync scripts
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rsync scripts相关的知识,希望对你有一定的参考价值。
#! /bin/bashif [ $# -ne 1 ];then
echo " usage:$0 {start|stop|restart}"
exit 5
fi
if [ "$1" = "start" ];then
rsync --daemon
sleep 1
if [ netstat -tnlup | grep rsync | wc -l
-ge 1 ];then
echo "rsync server is running."
exit 0
fi
elif [ "$1" = "stop" ];then
killall rysnc &> /dev/null
sleep 1
if [ netstat -tnlup | grep rsync | wc -l
-eq 0 ];then
echo "rsync is stopped."
exit 0
fi
elif [ "$1" = "restart" ];then
killall rsync &> /de/null
sleep 1
killpro=netstat -tlnup | grep rsync | wc -l
rsync --daemon
sleep 1
startpro=netstat -tnlup | grep rsync | wc -l
if [ $killpro -eq 0 -a $startpro -ge 1 ];then
echo "rsyncd is restart"
exit 0
fi
else
echo $"usage:$0 {start|stop|restart}"
exit 1
fi
以上是关于rsync scripts的主要内容,如果未能解决你的问题,请参考以下文章