#!/bin/bash#chkconfig:23453050#Date:2017-6-29#Author:xcn(baishuchao@yeah.net)#version1.0PID="/var/run/rsync.pid"start_rsync(){if[-f$PID]thenecho"rsyncisrunning"elsersync--daemonecho"rsyncisstarted"fi}stop_rsync(){if[-f$PID]#存在而不为空thenkill-USR2`cat$PID`rm-rf$PIDecho"rsyncisstoped"elseecho"rsyncnorunning"fi}case$1instart)start_rsync;;stop)stop_rsync;;restart)stop_rsyncstart_rsync;;*)echo"USAGE:$0{start|stop|restart}"exit1esac