Rsync starts closing shell scripts

Source: Internet
Author: User
Tags rsync

This script can be placed in the/etc/init.d/directory with service RSYNCD Start\stop\status\restart management, you can also use Chkconfig for boot-start management, detailed script content as follows:

#!/bin/bash# ******************************************************# author        : wangning# Last modified:2017-10-16 19:20# Email         : [email protected]# filename     : rsyncd# description  : # ******************************************************#  chkconfig: 2345 78 79# description: this is a rsyncd script .  /etc/init.d/functionsstart ()  {  rsync --daemon &>/dev/null   if [ $? = 0 ];then  action  "Startting rsync"  /bin/true   else  action  "Startting rsync"  /bin/false  fi}stop ()  {   if [ -e /var/run/rsyncd.pid ];then     kill  ' cat  /var/run/rsyncd.pid '  &>/dev/null     action  "Stopping rsync"  /bin/true   else     echo  "The rsyncd is not running"   fi} Status ()  {  if [ -e  "/var/run/rsyncd.pid"  ];then       echo -e  "\033[32m rsyncd is running \033[0m"   else       echo -e  "\033[31m rsyncd is stopped \033[0m"     fi}  restart ()  {   kill  ' cat /var/run/rsyncd.pid '   &>/dev/null   action  "Stopping rsync"  /bin/true   sleep  3    rsync --daemon &>/dev/null   action  " Startting rsync " /bin/true}case $1 in       start)       start      ;;       stop)       stop       ;;       status)       status       ;;       restart)       restart       ;;       *)       echo  "Usag: $0 {start |stop|status|restart} "Esac


This article is from the "Galloping Camel" blog, make sure to keep this source http://wn2100.blog.51cto.com/9915310/1973036

Rsync starts closing shell scripts

Related Article

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.