开发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#结构体与类区别
1. 结构体与类定义方式 结构体定义使用struct类定义使用class 结构体: struct testDemo{ int num; void action(){ } } 类: class test ...
- Android开发之Conversion to Dalvik format failed问题解决
[2014-4-21 21:28:06 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the ...
- dockerfile+ubuntu+nginx搭建web环境
准备目录 [root@izchz ~]# mkdir /usr/local/dockerfile1 该目录下准备Dockerfile文件 FROM ubuntu MAINTAINER xbf RUN ...
- 解读Unity中的CG编写Shader系列3——表面剔除与剪裁模式
在上一个样例中,我们得到了由mesh组件传递的信息经过数学转换至合适的颜色区间以颜色的形式着色到物体上. 这篇文章将要在此基础上研究片段的擦除(discarding fragments)和前面剪裁.后 ...
- 我的_vimrc文件
""""""""""""""""&quo ...
- 挑战--asp.net 文件夹上传
今天遇到一个有趣的问题,公司让平安做一个上传文件夹的功能,这个任务具有一定的挑战性哦.上传文件夹,我第一次看到有人这样做,以前都是上传压缩文件,从来就没有见人上传过文件夹,我也从来就没有尝试过.先不讨 ...
- 如何在Windows 10 IoT Core中添加其他语言的支持,如中文
目前很多开发者已经开始使用Windows 10 IoT来做物联网领域的开发了,目前Windows 10 IoT Core的版本支持树莓派2(以及新出的树莓派3).Minnowboard Max以及Dr ...
- Java集合系列之TreeMap源代码分析
一.概述 TreeMap是基于红黑树实现的.因为TreeMap实现了java.util.sortMap接口,集合中的映射关系是具有一定顺序的,该映射依据其键的自然顺序进行排序或者依据创建映射时提供的C ...
- push推送服务设计
PUSH系统架构设计简述 一.网络传输协议的选择 PUSH系统协议选取: UDP协议实时性更好,但是如何处理安全可靠的传输并且处理不同客户端之间的消息交互是个难题,实现起来过于复杂,那就非TCP协议莫 ...
- PHP 学习内容
第一阶段: (PHP+MySQL核心编程) 面向对象编程 MySQL数据库, MySQL的优化细节. HTTP协议,http也是我们web开发的基石.对我们了解PHP底层机制有很大帮助,做到知其然,还 ...