开发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是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性 ...
随机推荐
- C#中FileStream和StreamWriter/StreamReader的区别
首先致谢!转自:http://blog.sina.com.cn/s/blog_67299aec0100snk4.html 本篇可能不是非常深入,但是胜在清晰明了 FileStream对象表示在 ...
- Spring Framework简单介绍
Spring Framework 学习java编程不知不觉已经三年时间了,開始的时候,总是喜欢看着视频,然后按部就班的敲打着键盘,每当系统正常执行后.心里乐开了花.最開始的时候,所有的代 ...
- JSON解析工具-org.json使用教程
转自:http://www.open-open.com/lib/view/open1381566882614.html 一.简介 org.json是Java常用的Json解析工具,主要提供JSONO ...
- Amzaon EC2虚拟化技术演进:从 Xen 到 Nitro
今年2月,由光环新网运营的 AWS 中国(北京)区域和由西云数据运营的 AWS 中国 (宁夏)区域发布新的实例类型,新的实例类型包括 C5.C5d.R5.R5d.除了这四种之外,在AWS国外部分区 ...
- 华为nova3超级慢动作酷玩抖音,没有办法我就是这么强大!
华为nova3超级慢动作酷玩抖音,没有办法我就是这么强大! 在华为最新发布的nova 3手机上,抖音通过华为himedia SDK集成了60fps.超级慢动作等华为媒体开放能力,在加持这些能力后,抖音 ...
- 【elasticsearch】安装合集
[elasticsearch](1)centos7 使用yum安装elasticsearch 2.X [elasticsearch](2)centos7 超简单安装elasticsearch 的监控. ...
- sublime text 配置golang开发环境
一.准备工作: 1.下载Go语言包: https://code.google.com/p/go/downloads/list 2.下载Git: https://code.google.com/p/ms ...
- publish over ssh 实现 Jenkins 远程部署
Jenkins远程部署,一开始没有任何头绪,想了很多方案. 因为两台机器都是windows系统,所以想到publish over cifs, 但是这个网上资料太少,貌似只能内网使用.又想到了Jenki ...
- GT背靠背onsite
Google: 因为暑假在G家实习过,所以仅仅是简单面了2轮. 后来跟曾经的intern host吃饭得知,他和还有一个reviewer对我的实习工作都给了不错的评价,所以面试的时候面试官都放水了.题 ...
- mysql主从:主键冲突问题
1.检查从库 show slave status \G; Slave_IO_Running: YesSlave_SQL_Running: No 2.出现类似如下的报错: Last_SQL_Error: ...