开发rsync启动脚本2
使用函数更加规范的开发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的更多相关文章
- 开发rsync启动脚本
rsync rsync是类unix系统下的数据镜像备份工具——remote sync.一款快速增量备份工具 Remote Sync,远程同步 支持本地复制,或者与其他SSH.rsync主机同步. ...
- rsync启动脚本
rsync启动脚本 01 #!/bin/bash www.ahlinux.com 02 # 03 # rsyncd This shell script takes care of star ...
- 开发nginx启动脚本及开机自启管理(case)
往往我们在工作中需要自行写一些脚本来管理服务,一旦服务异常或宕机等问题,脚本无法自行管理,当然我们可以写定时任务或将需要管理的脚本加入自启等方法来避免这种尴尬的事情,case适用与写启动脚本,下面给大 ...
- 15:开发Rsync服务启动脚本案例
[root@m01 ~]# rsn_count="ps -ef|grep 'rsync --d[a]emon'|wc -l" [root@m01 ~]# echo ${rsn_co ...
- rsync随机启动脚本
服务端 #!/bin/sh # chkconfig: # description: Saves and restores system entropy pool for \ #create by xi ...
- Unity3D开发入门教程(三)——添加启动脚本
五邑隐侠,本名关健昌,12年游戏生涯. 本教程以 Unity 3D + VS Code + C# + tolua 为例. 一.启动脚本 第一篇 "搭建开发环境",在 "配 ...
- 【Linux开发】Linux启动脚本设置
前言linux有自己一套完整的启动 体系,抓住了linux启动 的脉络,linux的启动 过程将不再神秘.阅读之前建议先看一下附图.本文中假设inittab中设置的init tree为:/etc/rc ...
- linux shell 之尝试编写 企业级 启动脚本
企业Shell面试题10:开发企业级MySQL启动脚本 说明: MySQL启动命令为: 1 /bin/sh mysqld_safe --pid-file=$mysqld_pid_file_path 2 ...
- 老李推荐:第5章3节《MonkeyRunner源码剖析》Monkey原理分析-启动运行: 启动脚本
老李推荐:第5章3节<MonkeyRunner源码剖析>Monkey原理分析-启动运行: 启动脚本 poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性 ...
随机推荐
- Android版CSDN发现的一些问题
作为CSDN的忠有用户,在他一推出这款APP以后.就下载了使用,近期发现了一些个问题,在此提出来.希望看到或者遇到同样问题的,提出你们的解决方式. 在CSDN手机版的首页上,我 ...
- 细说Redirect重定向请求(情节分享)
前些日子在开发公司项目接口的时候,由于需要与第三方平台对接,由于接口之前的层层封装,不断的需要转发,把人差点搞糊涂了.本来以为之前对Redirect的认识足够清楚,可是到实际开发之前我还是没 ...
- 【Mac系统 + Python + Django】之搭建第一个【Django Demo(一)】
我编写的此系列学习资料是通过虫师的python接口自动化出的书学习而来的,在此说明一下,想学习更多的自动化的同学可以找虫师的博客园,非广告,因为我python+selenium自动化也是跟虫师学的,学 ...
- spring AOP pointcut expression表达式解析
Pointcut 是指那些方法需要被执行"AOP",是由"Pointcut Expression"来描述的.Pointcut可以有下列方式来定义或者通过& ...
- jQuery动态加载JS以减少服务器压力
如果您要创建一个web2.0的应用程序,那么你的网页会包括大量的JavaScript文件,这些可能会拖慢您的网页.因此,动态加载JavaScript代码到您的网页是一个好主意,即只有当实用他们的时候加 ...
- c# 怎么更改DataTable 中某列的值?
DataColumns dc = td.Columns["你的列"]; int inx = dc.Ordinal;td.Columns.Remove(dc);dc.DefaultV ...
- Nginx结合GeoIP库
1. 编译nginx时带上geoip模块 # wget http://nginx.org/download/nginx-x.x.x.tar.gz # tar zxvf nginx-x.x.x.tar. ...
- vue v-on命令
<!-- 阻止单击事件冒泡 --> <a v-on:click.stop="doThis"></a> <!-- 提交事件不再重载页面 ...
- Django APP之contenttypes简单应用
Conttenttypes介绍 当你看到contenttype你是不是想到了请求头的contenttype? 但是 此contenttypes不是请求头Content-Type而是Django自带的a ...
- 我的Android进阶之旅------>如何将Android源码导入Eclipse中来查看(非常实用)
Android源码下载完成的目录结构如如所示: step1:将.classpath文件拷贝到源代码的根目录 Android源码支持多种IDE,如果是针对APP层做开发的话,建议大家使用Eclipse开 ...