开发rsync启动脚本
-
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启动脚本的更多相关文章
- 开发rsync启动脚本2
使用函数更加规范的开发rsync启动脚本 #!/bin/bash #chkconfig: #description: create by vincen . /etc/init.d/functions ...
- 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是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性 ...
随机推荐
- SpringSecurity学习四----------基于不同角色跳转到不同URL
© 版权声明:本文为博主原创文章,转载请注明出处 1.项目结构 2.pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0& ...
- spring源码解析之IOC容器(二)------加载和注册
上一篇跟踪了IOC容器对配置文件的定位,现在我们继续跟踪代码,看看IOC容器是怎么加载和注册配置文件中的信息的.开始之前,首先我们先来了解一下IOC容器所使用的数据结构-------BeanDefin ...
- JAVA版SqlHelper
//JAVA版SqlHelper package com.test.Dao; import java.sql.Connection; import java.sql.DriverManager; im ...
- [译]GLUT教程 - 整合代码1
Lighthouse3d.com >> GLUT Tutorial >> Input >> The Code So Far 以下是前面几节的完整整合代码: #inc ...
- Yaml 的python 应用
1.安装yaml的python包 2.准备yaml的数据 3.yaml.load 解析yaml 3.生产yaml
- Android异步处理四:AsyncTask的实现原理
在<Android异步处理二:使用AsyncTask异步更新UI界面>一文中,我们介绍了如何使用AsyncTask实现异步下载图片,并且更新图片到UI界面的方法.本篇我们将学习Framew ...
- php修改密码
为了让页面更为好看一些,我一般会选择bootstrap,写起来虽然看着麻烦,但是我们真正需要的只有中间的内容 下面是html的内容 <div id="tbx"" ...
- XmlDocument.selectNodes() and selectSingleNode()的xpath的学习资料
Xpath网页: http://www.w3school.com.cn/xpath/xpath_syntax.asp XDocument.parse(string)类似于XmlDocument.loa ...
- 九度OJ 1324:The Best Rank(最优排名) (排序)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:489 解决:126 题目描述: To evaluate the performance of our first year CS major ...
- spring boot ajax post 前后端
1 传输的数据格式是json 1.1 前端ajax json的所有的key都必须是双引号引用的,并且最外层也要用双引号引用.例如 "{"a":b, "b&quo ...