了解了下shell的函数和case语句:

函数格式:
function(){

}

例子:
function rsyncstart() { 
    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 
}

 

 

case $1 in
    "start")
    rsyncstart
    ;;
    *)
    echo "123"
esac

相关文章:

  • 2021-06-24
  • 2021-07-24
  • 2022-01-21
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-25
  • 2022-02-13
  • 2022-12-23
  • 2022-01-17
  • 2021-06-13
  • 2022-01-08
  • 2021-11-03
相关资源
相似解决方案