#!/bin/sh # rsync boot file # write by : r.tang # mailto : [email protected] [ -f /etc/init.d/functions ] && . /etc/init.d/functions # basedir=$(dirname $(which rsync)) basedir=/usr/bin pidfile=/var/run/rsyncd.pid function DoAction() { [ $? -eq 0 ] && \ action "$doAct" /bin/true || \ action "$doAct" /bin/false } function start() { doAct="Starting Rsync Daemon " [ -e $pidfile ] || $basedir/rsync --daemon DoAction } function stop() { doAct="Stoping Rsync Daemon" [ -e $pidfile ] && kill -9 $(cat $pidfile) && rm -f $pidfile DoAction } function status() { [ -e $pidfile ] && \ echo "Rsync is Running [ $(cat $pidfile) ]" || \ echo "Rsync is Stopped" } case $1 in start) start ;; stop) stop ;; restart) stop && sleep 2 start ;; status) status ;; *) echo "Usage: $0 [start|stop|restart|status]" ;; esac
rsync daemon控制腳本
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.