利用shell开发rsync服务启动脚本
发布时间:2020-12-15 19:57:38 所属栏目:安全 来源:网络整理
导读:利用shell函数开发rsync服务启动脚本,之前的不够专业 #!/bin/bash#chkconfig:23452080#这两行加入kconfig#description:Savesandrestoressystementropypoolsource/etc/init.d/functions#调用标准的函数库aa(){echo"plzonecanshu"exit5}bb(){if[$1=="start"];
利用shell函数开发rsync服务启动脚本,之前的不够专业 #!/bin/bash #chkconfig:23452080#这两行加入kconfig #description:Savesandrestoressystementropypool source/etc/init.d/functions#调用标准的函数库 aa(){ echo"plzonecanshu" exit5 } bb(){ if[$1=="start"];then rsync--daemon if["`netstat-tlnup|greprsync|wc-l`"-gt0];then action"startingrsgnc..."/bin/true#注意这里 else action"stopedrsync..."/bin/flase exit6 fi elif[$1=="stop"];then #kill"`ps-ef|greprsync|grep-vgrep|awk-F'''{print$2}'`" killallrsync sleep2 if["`netstat-tlnup|greprsync|wc-l`"-eq0] thenaction"rsyncisstopped"/bin/true else action"nostop"/bin/flase exit3 fi elif[$1=="restart"];then #kill"`ps-ef|greprsync|grep-vgrep|awk-F'''{print$2}'`" killallrsync sleep2 rsync--daemon if["`netstat-tlnup|greprsync|wc-l`"-gt0] thenaction"rsyncisstarting"/bin/true else action"rsyncisstopped"/bin/flase exit2 fi else echo"plzcurrtint" fi } main(){ if[$#-ne1] then aa fi bb$1 } main$* (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |