linux系统服务rsync启动脚本
2014-06-02 16:16
489 查看
本脚本估计存在一些问题:如有发现,请告知谢谢~
本文出自 “Alan wake” 博客,请务必保留此出处http://alanwake.blog.51cto.com/6881848/1421188
#!/bin/sh # chkconfig: 2345 21 60 # description: Saves and restores system entropy pool for \ #create by xiaohu #2014.06.02 #This script is the Rsync service script . /etc/init.d/functions case "$1" in start) echo "rsync is starting" rsync --daemon sleep 2 myport=`netstat -lnt|grep 873|wc -l` if [ $myport -eq 2 ] then action "rsync start" /bin/true else action "rsync start" /bin/false fi ;; stop) echo "rsync is stoping" myport=`netstat -lnt|grep 873|wc -l` if [ $myport -eq 2 ] then killall rsync &>/dev/null sleep 2 killall rsync &>/dev/null sleep 1 fi myport=`netstat -lnt|grep 873|wc -l` if [ $myport -ne 2 ] then action "rsync stop" /bin/true else action "rsync stop" /bin/false fi ;; restart) if [ `netstat -lnt|grep 873|wc -l` -eq 0 ] then rsync --daemon sleep 2 myport=`netstat -lnt|grep 873|wc -l` if [ $myport -eq 2 ] then action "rsync restart" /bin/true else action "rsync restart" /bin/false exit fi else killall rsync &>/dev/null sleep 2 killall rsync &>/dev/null sleep 1 rsync --daemon sleep 2 myport=`netstat -lnt|grep 873|wc -l` if [ $myport -eq 2 ] then action "rsync restart" /bin/true else action "rsync restart" /bin/false fi fi ;; status) myport=`netstat -lnt|grep 873|wc -l` if [ $myport -eq 2 ] then echo "rsync is running" else echo "rsync is stoped" fi ;; *) echo $"Usage: $0 {start|stop|status|restart}" ;; esac在stop参数中,不建议采用pkill或看kill,尤其是数据库方面,容易让服务出现问题。
本文出自 “Alan wake” 博客,请务必保留此出处http://alanwake.blog.51cto.com/6881848/1421188
相关文章推荐
- linux系统服务rsync启动脚本
- 在Linux系统下启动服务(包含main的java类)脚本(sockos.sh)
- linux安装redis并使用其提供的初始化启动脚本加入到系统服务中
- Linux系统禁用的(启动)服务脚本
- linux安装redis并使用其提供的初始化启动脚本加入到系统服务中
- Linux_自制系统服务启动脚本
- suse linux原创案例08:配置脚本或服务随linux系统启动
- Linux系统开机自动启动脚本。自动加载某些脚本或系统服务
- 写得一个linux系统服务脚本
- linux系统下tftp服务的安装与启动
- oracle 服务启动,关闭脚本(windows系统下)
- Linux系统启动脚本分析之rc
- 关于Linux系统开机启动脚本
- cmd下启动oracle服务(linux系统)
- LINUX下如何修改系统的服务启动和停止
- oracle 10g 随linux系统自动启动的设置脚本
- NFS 网络文件系统/ARM-LINUX NFS服务启动设置
- 介绍Linux系统开机如何初始化和启动系统服务
- Linux如何修改系统的服务启动和停止
- 在linux系统上启动oracle的服务