This commit is contained in:
midoks
2019-09-12 22:38:34 +08:00
parent 44e3434b6d
commit 50706f9286
2 changed files with 107 additions and 44 deletions
+47
View File
@@ -0,0 +1,47 @@
#!/bin/sh
# chkconfig: 2345 55 25
# description: rsyncd Service
### BEGIN INIT INFO
# Provides: rsyncd
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts rsyncd
# Description: starts the MDW-Web
### END INIT INFO
ROOT_PATH={$SERVER_PATH}
p_start(){
echo "Starting ..."
cd $ROOT_PATH/rsyncd/init.d
/usr/bin/rsync --daemon
echo "rsyncd started"
}
p_stop(){
echo "Stopping ..."
ps -ef | grep rsync | grep -v grep | grep -v python | awk '{print $2}' | xargs kill -9
echo "rsyncd stopped"
}
case "$1" in
start)
p_start
;;
stop)
p_stop
;;
restart|reload)
p_stop
sleep 0.3
p_start
;;
*)
echo "Please use start or stop as first argument"
;;
esac