zoukankan      html  css  js  c++  java
  • rsync 04-rsyncd启动脚本

    #!/bin/bash
    
    # chkconfig:  - 85 15
    # description: rsync
    
    status1=$(ps -ef | egrep "rsync --daemon.*rsyncd.conf" | grep -v 'grep') 
    pidfile="/var/run/rsyncd.pid" 
    start_rsync="rsync --daemon --config=/etc/rsyncd/rsyncd.conf"
    
    function rsync_start() { 
        if [ "${status1}X" == "X" ]; then 
            rm -f $pidfile      
            ${start_rsync}  
            status2=$(ps -ef | egrep "rsync --daemon.*rsyncd.conf" | grep -v 'grep') 
            if [  "${status2}X" != "X"  ]; then 
                echo "rsync service start.......OK" 
            fi 
        else 
            echo "rsync service is running !"    
        fi 
    }
    
    function rsync_stop() { 
        if [ "${status1}X" != "X" ]; then 
            kill -9 $(cat $pidfile) 
            status2=$(ps -ef | egrep "rsync --daemon.*rsyncd.conf" | grep -v 'grep') 
            if [ "${statusw2}X" == "X" ]; then 
                echo "rsync service stop.......OK" 
            fi 
        else 
            echo "rsync service is not running !"    
        fi 
    }
    
    function rsync_status() { 
        if [ "${status1}X" != "X" ]; then 
            echo "rsync service is running !"  
          
        else 
            echo "rsync service is not running !"  
        fi 
    }
    
    function rsync_restart() { 
        if [ "${status1}X" == "X" ]; then 
                  echo "rsync service is not running..." 
                  rsync_start 
            else 
                  rsync_stop 
                  rsync_start    
            fi      
    } 
    
    case $1 in 
            "start") 
                  rsync_start 
                    ;; 
            "stop") 
                  rsync_stop 
                    ;; 
            "status") 
                  rsync_status 
                  ;; 
            "restart") 
                  rsync_restart 
                  ;; 
            *) 
              echo 
                    echo  "Usage: $0 start|stop|restart|status" 
              echo 
    esac
    
  • 相关阅读:
    flex布局
    redis持久化的四种方式
    list all index in elasticsearch
    Java Thread停止关闭
    关于线程的一些操作方法
    将redis key打印到文本
    spout和bolt
    java读取redis的timeout异常
    storm中,ack与fail
    好文要收藏(大数据)
  • 原文地址:https://www.cnblogs.com/liangjingfu/p/9759108.html
Copyright © 2011-2022 走看看