#!/bin/sh
#filename: rsync_start.sh
#date: 2015-12-14
#linuxzkq
#version: v1.0
# chkconfig:2345 23 65
# Description:start Rsync and stop rsync scripts.
Prog= "Rsync"
Pidfile=/var/run/rsyncd.pid
Exec=/usr/bin/rsync
. /etc/init.d/functions
[-f/usr/bin/rsync] | | echo "Please install and config rsync!"
#USAGE
function USAGE () {
echo "usage:$0 {Start|stop|restart}"
Exit 1
}
#start
function Start () {
$exec--daemon >/dev/null 2>&1
If [-S "$pidfile"]
Then
Action "Rsync haved already been running"/bin/false
Else
$exec--daemon >/dev/null 2>&1
Action "Start RSYNCD:"/bin/true
Fi
}
#stop
function Stop () {
If [-F "$pidfile"]
Then
KILL-USR2 ' Cat $pidfile '
Rm-f ${pidfile}
Action "Stop RSYNCD:"/bin/true
Else
Action "Rsync no running!"/bin/false
Fi
}
Case "$" in
Start) Start
Retval=$?
;;
Stop) stop
Retval=$?
;;
Restart) Stop && sleep 2 && start
Retval=$?
;;
*) echo "error,please use of an usage!"
USAGE
Esac
Exit $RETVAL
Welcome all netizens to shoot bricks, veteran and high finger is!
This article is from the "Lanzhou Linux operation and Maintenance" blog, please be sure to keep this source http://linuxzkq.blog.51cto.com/9379412/1723344
Rsync service startup script