使用函数更加规范的开发rsync启动脚本

#!/bin/bash
#chkconfig:
#description: create by vincen . /etc/init.d/functions function usage(){
echo $"usage:$0 {start|stop|restart}"
exit
} function start(){
rsync --daemon
sleep
if [ `netstat -lntup|grep rsync|wc -l` -ge ];then
action "rsyncd is started." /bin/true
else
action "rsyncd is started." /bin/false
fi
} function stop(){
killall rsync
sleep
if [ `netstat -lntup|grep rsync|wc -l` -eq ];then
action "rsyncd is stopped." /bin/true
else
action "rsync is started." /bin/false
fi
} function main(){
if [ $# -ne ];then
usage
fi
if [ "$1" == "start" ];then
start
elif [ "$1" == "stop" ];then
stop
elif [ "$1" == "restart" ];then
stop
sleep
start
else
usage
fi
}
main $*

执行结果:

[root@rhel6 script]# /etc/init.d/rsyncd start
rsyncd is started. [ OK ]
[root@rhel6 script]# vim /etc/init.d/rsyncd
[root@rhel6 script]# /etc/init.d/rsyncd start
rsyncd is started. [ OK ]
[root@rhel6 script]# /etc/init.d/rsyncd stop
rsyncd is stopped. [ OK ]
[root@rhel6 script]# /etc/init.d/rsyncd restart
rsync: no process killed
rsyncd is stopped. [ OK ]
rsyncd is started. [ OK ]

开发rsync启动脚本2的更多相关文章

  1. 开发rsync启动脚本

    rsync rsync是类unix系统下的数据镜像备份工具——remote sync.一款快速增量备份工具 Remote Sync,远程同步 支持本地复制,或者与其他SSH.rsync主机同步.   ...

  2. rsync启动脚本

    rsync启动脚本 01 #!/bin/bash  www.ahlinux.com 02 # 03 # rsyncd      This shell script takes care of star ...

  3. 开发nginx启动脚本及开机自启管理(case)

    往往我们在工作中需要自行写一些脚本来管理服务,一旦服务异常或宕机等问题,脚本无法自行管理,当然我们可以写定时任务或将需要管理的脚本加入自启等方法来避免这种尴尬的事情,case适用与写启动脚本,下面给大 ...

  4. 15:开发Rsync服务启动脚本案例

    [root@m01 ~]# rsn_count="ps -ef|grep 'rsync --d[a]emon'|wc -l" [root@m01 ~]# echo ${rsn_co ...

  5. rsync随机启动脚本

    服务端 #!/bin/sh # chkconfig: # description: Saves and restores system entropy pool for \ #create by xi ...

  6. Unity3D开发入门教程(三)——添加启动脚本

    五邑隐侠,本名关健昌,12年游戏生涯. 本教程以 Unity 3D + VS Code + C# + tolua 为例. 一.启动脚本 第一篇 "搭建开发环境",在 "配 ...

  7. 【Linux开发】Linux启动脚本设置

    前言linux有自己一套完整的启动 体系,抓住了linux启动 的脉络,linux的启动 过程将不再神秘.阅读之前建议先看一下附图.本文中假设inittab中设置的init tree为:/etc/rc ...

  8. linux shell 之尝试编写 企业级 启动脚本

    企业Shell面试题10:开发企业级MySQL启动脚本 说明: MySQL启动命令为: 1 /bin/sh mysqld_safe --pid-file=$mysqld_pid_file_path 2 ...

  9. 老李推荐:第5章3节《MonkeyRunner源码剖析》Monkey原理分析-启动运行: 启动脚本

    老李推荐:第5章3节<MonkeyRunner源码剖析>Monkey原理分析-启动运行: 启动脚本   poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性 ...

随机推荐

  1. iOS 最新公布app到AppStore全流程具体解释

    一.生成公布证书(证书的作用:类似于驾照,证明你的身份能够进行开发人员一些操作) 打开https://developer.apple.com 点击右上角开发人员中心 这里输入你付款过的Apple 帐号 ...

  2. Extjs4 Combobox 联动始终出现loading错误的解决的方法

    当反复选者combobox 联动时,下级的Combobox 会出现loading的错误表现形式,尽管Store数据已载入完也是一样. 废话少说贴代码就知道怎样处理了:(注意红色部分的关键语句) }, ...

  3. HUAWEI HiAI亮相Droidcon柏林2018开发者峰会 开启HiAI海外生态

    柏林时间6月25日到27日,华为HiAI亮相Droidcon柏林2018开发者峰会,有1200多位海外开发者参加了此次峰会,来自HUAWEI HiAI领域的多名专家携手Prisma和金山WPS,以“E ...

  4. Android Studio中查看类的继承关系

    查看类的继承关系的快捷键F4.在Android Studio经常使用快捷键这篇文章中.有写了.今天主要是讲一些关于这个快捷键出来的界面的一些配置.这块功能相对偏冷一些,可能非常多人都会用不到.可是关于 ...

  5. EasyUI分页(前台分页和后台分页)

    整理一下以前的总结: 分页包括前台分页和后台分页两种,针对数据量比较小的,比如说单位,角色等,可以使用前台分页,而针对日志文件这些,需要后台分页. 先说说前台分页吧: function pagerFi ...

  6. Python snap

    orderedDict enum sys.path 注册装饰器 装饰器检查 入参 Flask01 flask_script flask blue print functools.partial dns ...

  7. Java研发工程师面试题

    基础题 一.String,StringBuffer, StringBuilder 的区别是什么?String为什么是不可变的?1. String是字符串常量,StringBuffer和StringBu ...

  8. ios 手势返回<1>2

    iOS-给push出来的控制器添加全局滑动(返回)手势   在iOS中,当我们push出一个新的控制器的时候,我们可以向右拖拽屏幕的左边缘来返回(pop)到上一级控制器,但是这个功能有两个缺陷: 当自 ...

  9. GET,POST

    HTTPHTTP(即超文本传输协议)是现代网络中最常见和常用的协议之一,设计它的目的是保证客户机和服务器之间的通信.HTTP 的工作方式是客户端与服务器之间的 “请求-响应” 协议.客户端可以是 We ...

  10. The space of such functions is known as a reproducing kernel Hilbert space.

    Reproducing kernel Hilbert space Mapping the points to a higher dimensional feature space http://www ...