Rsync service startup script

Source: Internet
Author: User
Tags rsync

#!/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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.