首页 > 其他 > 详细

rsync启动脚本

时间:2017-06-29 21:55:52      阅读:249      评论:0      收藏:0      [点我收藏+]
#!/bin/bash
#chkconfig: 2345 30 50
#Date:2017-6-29
#Author:xcn(baishuchao@yeah.net)
#version 1.0
PID="/var/run/rsync.pid"
start_rsync(){
if [ -f $PID ]  
then 
	echo "rsync is running"
else
	 rsync --daemon
	echo "rsync is started"
fi
}

stop_rsync(){
if [ -f $PID ]   #存在而不为空
then
	kill -USR2 `cat $PID`
	rm -rf $PID
	echo "rsync is stoped"
else
	echo "rsync no running"
fi
}

case $1 in
	start)
	start_rsync
	;;
	stop)
	stop_rsync
	;;
	restart)
	stop_rsync
	start_rsync
	;;
	*)
	echo "USAGE:$0 {start|stop|restart}"
	exit1
esac


本文出自 “小菜鸟” 博客,请务必保留此出处http://baishuchao.blog.51cto.com/12918589/1943177

rsync启动脚本

原文:http://baishuchao.blog.51cto.com/12918589/1943177

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