pull/143/head
midoks 3 years ago
parent 1038617028
commit 999a611343
  1. 70
      plugins/rsyncd/init.d/lsyncd.service.tpl
  2. 108
      plugins/rsyncd/init.d/lsyncd.tpl
  3. 2
      plugins/rsyncd/install.sh

@ -0,0 +1,70 @@
#!/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 rsyncd
### END INIT INFO
ROOT_PATH={$SERVER_PATH}
p_start(){
isStart=$(ps -ef | grep rsync | grep 'daemon' | grep -v grep | grep -v python | awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "Starting rsync... \c"
if [ -f /var/run/rsyncd.pid ]; then
rm -rf /var/run/rsyncd.pid
fi
/usr/bin/rsync --daemon --config=/etc/rsyncd.conf
sleep 0.3
isStart=$(ps -ef | grep rsync | grep 'daemon' | grep -v grep | grep -v python | awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "\033[31mError: rsyncd service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting rsyncd(pid $isStart) already running"
fi
}
p_stop(){
echo -e "Stopping rsyncd... \c";
pids=$(ps -ef | grep rsync | grep 'daemon' | grep -v grep | grep -v python | awk '{print $2}')
arr=($pids)
for p in ${arr[@]}
do
kill -9 $p
done
if [ -f /var/run/rsyncd.pid ]; then
rm -rf /var/run/rsyncd.pid
fi
echo -e "\033[32mdone\033[0m"
}
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

@ -0,0 +1,108 @@
#!/bin/bash
#
# chkconfig: - 85 15
# description: Lightweight inotify based sync daemon
#
# processname: lsyncd
# config: /etc/lsyncd.conf
# config: /etc/sysconfig/lsyncd
# pidfile: /var/run/lsyncd.pid
# Source function library
if [ -f /etc/init.d/functions ];then
. /etc/init.d/functions
fi
if [ -f /lib/lsb/init-functions ];then
. /lib/lsb/init-functions
fi
# Source networking configuration.
if [ -f /etc/sysconfig/network ];then
. /etc/sysconfig/network
fi
LSYNCD_OPTIONS="-pidfile /var/run/lsyncd.pid /etc/lsyncd.conf"
if [ -e /etc/sysconfig/lsyncd ]; then
. /etc/sysconfig/lsyncd
fi
RETVAL=0
prog="lsyncd"
thelock=/var/lock/subsys/lsyncd
LSYNCD_USER=root
start() {
[ -f /etc/lsyncd.conf ] || exit 6
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
nohup /usr/bin/lsyncd $LSYNCD_OPTIONS > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $thelock
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc lsyncd
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $thelock
fi;
echo
return $RETVAL
}
reload(){
echo -n $"Reloading $prog: "
killproc lsyncd -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e $thelock ] && restart
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
condrestart
;;
status)
status lsyncd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1
esac
exit $RETVAL

@ -14,9 +14,9 @@ sysName=`uname`
# bash /www/server/mdsever-web/scripts/getos.sh
bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
echo $OSNAME
install_tmp=${rootPath}/tmp/mw_install.pl
Install_rsyncd()
{

Loading…
Cancel
Save