rsync

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

启动/停止命令:

rsync --daemon
pkillall rsync
 

rsync脚本

#!/bin/bash

if [ $# -ne  ];then
echo $"usage:$0 {start|stop|restart}"
exit
fi if [ "$1" = "start" ];then
rsync --daemon
sleep
if [ `netstat -lntup|grep rsync|wc -l` -ge ];then
echo "rsyncd is started."
exit
fi
elif [ "$1" = "stop" ];then
killall rsync
sleep
if [ `netstat -lntup|grep rsync|wc -l` -eq ];then
echo "rsyncd is stopped."
exit
fi
elif [ "$1" == "restart" ];then
killall rsync &>/dev/null
sleep
killpro=`netstat -lntup|grep rsync|wc -l`
rsync --daemon
sleep
startpro=`netstat -lntup|grep rsync|wc -l`
if [ $killpro -eq -a $startpro -ge ];then
echo "rsyncd is restarted."
exit
fi
else
echo $"usage:$0 {start|stop|restart}"
exit
fi

添加到chkconfig

需要在脚本开头添加以下两行内容: 2345启动基本, 20启动顺序,80停止顺序

#chkconfig:
#description: create by vincen
#!/bin/bash
#chkconfig:
#description: create by vincen
if [ $# -ne ];then
echo $"usage:$0 {start|stop|restart}"
exit
fi if [ "$1" = "start" ];then
rsync --daemon
sleep
if [ `netstat -lntup|grep rsync|wc -l` -ge ];then
echo "rsyncd is started."
exit
fi
elif [ "$1" = "stop" ];then
killall rsync
sleep
if [ `netstat -lntup|grep rsync|wc -l` -eq ];then
echo "rsyncd is stopped."
exit
fi
elif [ "$1" == "restart" ];then
killall rsync &>/dev/null
sleep
killpro=`netstat -lntup|grep rsync|wc -l`
rsync --daemon
sleep
startpro=`netstat -lntup|grep rsync|wc -l`
if [ $killpro -eq -a $startpro -ge ];then
echo "rsyncd is restarted."
exit
fi
else
echo $"usage:$0 {start|stop|restart}"
exit
fi
[root@rhel6 ~]# chkconfig --list rsyncd
service rsyncd supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add rsyncd')
[root@rhel6 ~]# chkconfig --add rsyncd
[root@rhel6 ~]# chkconfig --list rsyncd
rsyncd :off :off :on :on :on :on :off

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

  1. 开发rsync启动脚本2

    使用函数更加规范的开发rsync启动脚本 #!/bin/bash #chkconfig: #description: create by vincen . /etc/init.d/functions ...

  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. winform对话框拖拽显示文件路径的问题

    allow drop=true; dragEnter dragDrop vs管理员账户拖拽会失败

  2. Android适配方案小结(二)

    该节主要记录从代码中获取与屏幕适配相关的各个參数: Java代码例如以下 public class ScreenUtil { /** * Note: * 仅仅有activity能够使用getWindo ...

  3. BGP双线的真真假假

    BGP双线的真真假假: 国内不少IDC服务商都号称自己是“真正的双线”.“双线单IP”.“全路由双线”,但是,这其中有没有水分?他们都是BGP双线?BGP的门槛真的这么低吗? 首先,要构建真正的BGP ...

  4. Spark高速上手之交互式分析

    1.1  Spark交互式分析 执行Spark脚本前,启动Hadoop的HDFS和YARN.Spark的shell提供 了简单方式去识别API.相同也有一个强大的工具去交互式地分析数据. 两种语言有这 ...

  5. OpenGL/GLSL数据传递小记(2.x)(转)

    本篇记录一下关于OpenGL程序中绑定各种GLSL变量的一些注意问题(有些是近期编写代码感受强烈的).以供参考.——ZwqXin.com 本文来源于 ZwqXin (http://www.zwqxin ...

  6. 启动 ./spark-shell 命令报错

    当使用./spark-shell 命令报错 Caused by: ERROR XJ040: Failed to start database @476fde05, see the next excep ...

  7. DB2 中like的通配符以及escape关键字定义转义字符的使用

    DB2 LIKE谓词查询语句中支持 百分号(%).下划线(_)的使用,不支持方括号([])(注:它会把方括号当成实际的值而非通配符),当我们需要在LIKE 查询条件中将百分号(%).下划线(_)作为实 ...

  8. 【SoapUI、Postman、WebServiceStudio、Jmeter】接口测试工具结合测试webservice接口(发送XML格式参数)

    目录: SoapUI测试webservice接口,发送XML格式参数 Postman测试webservice接口,发送XML格式参数 WebServiceStudio.exe测试webservice接 ...

  9. GitHub 寻宝指南

    GitHub 寻宝指南 寻找 Demo 技术栈的关键字搜索,并按更新时间进行排序 生命有限 ,如若是每次我们尝试一个新的技术,总得自己编写一个个 Demo.编写多个 Demo,都得花去个半天八小时的时 ...

  10. xpath 获取父级,和同级

    XPath轴(XPath Axes)可定义某个相对于当前节点的节点集: 1.child 选取当前节点的所有子元素 2.parent 选取当前节点的父节点 3.descendant 选取当前节点的所有后 ...