Using the shell to develop the Rsync service startup script

Source: Internet
Author: User
Tags rsync

Using shell functions to develop the Rsync service startup script, previously unprofessional

#!/bin/bash#chkconfig: 2345  20 80                         #这两行加入kconfig #description:  saves and restores system entropy  poolsource /etc/init.d/functions      #调用标准的函数库aa ()  {  echo  "Plz one canshu"   exit  5}BB ()  {if [ $1 ==  "Start"  ]; then  rsync --daemon   if [  "' Netstat -tlnup | grep rsync | wc -l '"  -gt  0 ]; then    action  "Starting rsgnc ..."  /bin/true       #注意这里   else    action  "stoped rsync... "   /bin/flase  exit 6fielif [ $1 ==  "Stop"  ]; then  # kill   "'ps -ef | grep rsync | grep -v grep | awk -f  '   '   ' {print $2} ' "  killall rsync  sleep 2  if   [  "' netstat -tlnup | grep rsync | wc -l '"  -EQ 0 ]     then  action  "rsync is stopped"  /bin/true   else     action  "No stop"  /bin/flase  exit 3   fielif [ $1 ==  "Restart"  ]; then   #kill   "' ps -ef  | grep rsync | grep -v grep | awk -f  '   '   ' {print  $2} ' "  killall rsync  sleep 2  rsync --daemon   if [  "' Netstat -tlnup | grep rsync | wc -l '"  -gt 0   ]    then  action  "Rsync is starting"   /bin/true  else     action  "rsync is stopped"   /bin/flase    exit 2   fielse  echo  "Plz currt int" Fi}main ()  {if [ $# -ne  1 ]  then    aafibb $1}main $*

Using the shell to develop the Rsync service startup script

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.