开发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是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性 ...
随机推荐
- 让 webpack 加载 Source Map
在浏览器中运行的 JavaScript 代码都是编译器输出的代码,这些代码的可读性很差.如果在开发过程中遇到一个不知道原因的 Bug,则你可能需要通过断点调试去找出问题. 在编译器输出的代码上进行断点 ...
- Struts2 后台获取路径的几种方法
Struts2 后台获取路径的几种方法 package actions.app; import java.io.File; import org.apache.struts2.ServletActio ...
- synchronized加static区别
在多线程中,在synchronise方法上加上static 表示的是类锁,锁住的是整个类.而synchroinized 锁住的是当前方法,当前对象.
- inotify+rsync
backup_to_rsync.sh #!/bin/bash #source function library . /etc/init.d/functions rsync_host=rsync.eti ...
- lua学习笔记(十三)
math库 定义在math中 所有三角函数都使用弧度 指数和对数函数 取整函数 伪随机数math.random 调用时没有参数返回0~1之间的随 ...
- Apache安全和强化的十三个技巧
Apache是一个很受欢迎的web服务器软件,其安全性对于网站的安全运营可谓生死攸关.下面介绍一些可帮助管理员在Linux上配置Apache确保其安全的方法和技巧. 本文假设你知道这些基本知识: 文档 ...
- [译]GLUT教程 - 交换菜单
Lighthouse3d.com >> GLUT Tutorial >> Pop-up Menus >> Swapping Menus GLUT甚至可以在应用程序过 ...
- mongodb中批量将时间戳转变通用日期格式
1,官网提供的mongodb遍历脚本: 官方文档地址:https://docs.mongodb.org/manual/tutorial/remove-documents/ >var arr = ...
- 【WPF学习笔记】之依赖属性
概述: Windows Presentation Foundation (WPF) 提供了一组服务,这些服务可用于扩展公共语言运行时 (CLR) 属性的功能.这些服务通常统称为 WPF 属性系统.由 ...
- iOS 生命周期 -init、viewDidLoad、viewWillAppear、viewDidAppear、viewWillDisappear、viewDidDisappear 区别和用途
iOS视图控制对象生命周期-init.viewDidLoad.viewWillAppear.viewDidAppear.viewWillDisappear.viewDidDisappear的区别及用途 ...