#!/bin/sh
#filename:rsync_start.sh
#date:2015-12-14
#作者:linuxzkq
#version:v1.0
# chkconfig: 2345 23 65
# description: Start rsync and stop rsync scripts.
prog="rsync"
pidfile=/var/run/rsyncd.pid
exec=/usr/bin/rsync
. /etc/init.d/functions
[ -f /usr/bin/rsync ] || echo "please install and config rsync!"
#USAGE
function USAGE(){
echo "USAGE:$0 {start|stop|restart}"
exit 1
}
#start
function start(){
$exec --daemon >/dev/null 2>&1
if [ -s "$pidfile" ]
then
action "rsync haved already been running" /bin/false
else
$exec --daemon >/dev/null 2>&1
action "start rsyncd:" /bin/true
fi
}
#stop
function stop(){
if [ -f "$pidfile" ]
then
kill -USR2 `cat $pidfile`
rm -f ${pidfile}
action "stop rsyncd:" /bin/true
else
action "rsync no running!" /bin/false
fi
}
case "$1" in
start) start
RETVAL=$?
;;
stop) stop
RETVAL=$?
;;
restart) stop && sleep 2 && start
RETVAL=$?
;;
*) echo "Error,Please use an USAGE!"
USAGE
esac
exit $RETVAL
Rsync服務啓動腳本
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
詳解關於Vuex的action傳入多個參數的問題
薛颖
2019-02-24 12:43:05
Linux文本處理三劍客之-awk
Linux_yun
2019-02-22 23:56:47
怎麼解決tomcat佔用8080端口問題圖文教程
Spi08Breaker
2019-02-23 00:05:46
linux top命令詳解
李焱心
2019-02-22 23:53:30
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
llmetet
2019-02-22 23:49:52
linux top命令詳解
snailxiaoyu
2019-02-22 23:45:50
centos ***
samplelife
2019-02-23 13:57:36
交換機的基本配置實驗報告
乘風來
2019-02-23 13:00:59
交換機的基本配置實驗報告
1406404037
2019-02-23 12:50:57
Hbase中多版本(version)數據獲取辦法
supersyd
2019-02-23 00:16:58
linux下如何查看系統和內核版本
zwq5337
2019-02-23 00:04:44
查看Linux系統版本信息
ruyinote
2019-02-22 23:46:05