I create an update for the luncher 

place the script in /etc/init.d/

the script is create via skeleton  wiht the start-stop-daemon

-- 
You received this message because you are subscribed to the Google Groups 
"mwlib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
#! /bin/sh
### BEGIN INIT INFO
# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

# Author: Foo Bar <[email protected]>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="Rendler server collection for MediaWiki"
NAME_NSERVE=nserve
NAME_MWQSERVE=mw-qserve
NAME_NSLAVE=nslave
DAEMON_NSERVE=/usr/local/bin/$NAME_NSERVE
DAEMON_MWQSERVE=/usr/local/bin/$NAME_MWQSERVE
DAEMON_NSLAVE=/usr/local/bin/$NAME_NSLAVE
DAEMON_ARGS_NSERVE="" #args nserve
DAEMON_ARGS_MWQSERVE="" #args mw-qserve
DAEMON_ARGS_NSLAVE="--cachedir /data/mwcache" # args nslave
PIDFILE_NSERVE=/var/run/$NAME_NSERVE.pid
PIDFILE_MWQSERVE=/var/run/$NAME_MWQSERVE.pid
PIDFILE_NSLAVE=/var/run/$NAME_NSLAVE.pid
SCRIPTNAME=/etc/init.d/rendu_pdf
$VERBOSE


#
# Function that starts the daemon/service
#
#do_start()
#


do_start_nserve() {
	touch $PIDFILE_NSERVE
	start-stop-daemon --start --quiet -b -m --pidfile $PIDFILE_NSERVE --exec /usr/local/bin/nserve --test > /dev/null \
		|| return 1

	start-stop-daemon --start --quiet -b -m --pidfile $PIDFILE_NSERVE --exec $DAEMON_NSERVE -- \
		$DAEMON_ARGS_NSERVE \
		|| return 2
	echo "Starting nserve"
	return 0
}

do_start_mw_qserve() {
	start-stop-daemon --start --quiet -b -m  --pidfile $PIDFILE_MWQSERVE --exec $DAEMON_MWQSERVE --test > /dev/null \
		|| return 1

	start-stop-daemon --start --quiet -b -m  --pidfile $PIDFILE_MWQSERVE --exec $DAEMON_MWQSERVE -- \
		$DAEMON_ARGS_MWQSERVE \
		|| return 2
	echo "Starting mw-qserve"
	return 0
}

do_start_nslave() {
	start-stop-daemon --start --quiet -b -m  --pidfile $PIDFILE_NSLAVE --exec $DAEMON_NSLAVE --test > /dev/null \
		|| return 1

	start-stop-daemon --start --quiet -b -m --pidfile $PIDFILE_NSLAVE --exec $DAEMON_NSLAVE -- \
		$DAEMON_ARGS_NSLAVE \
		|| return 2
	echo "Starting nslave"
	return 0
}

#
# Function that stops the daemon/service
#
#do_stop()
#


do_stop_nserve() {
	start-stop-daemon --stop --quiet  --retry=TERM/30/KILL/5 --pidfile $PIDFILE_NSERVE --name $NAME_NSERVE
	RETVAL="$?"
	[ "$RETVAL" = 2 ] && return 2

	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON_NSERVE
	[ "$?" = 2 ] && return 2
	rm -f $PIDFILE_NSERVE
	echo "Shutdown nserve"
	return "$RETVAL"
}

do_stop_mw_qserve() {
	start-stop-daemon --stop --quiet  --retry=TERM/30/KILL/5 --pidfile $PIDFILE_MWQSERVE --name $NAME_MWQSERVE
	RETVAL="$?"
	[ "$RETVAL" = 2 ] && return 2

	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON_MWQSERVE
	[ "$?" = 2 ] && return 2
	rm -f $PIDFILE_MWQSERVE
		echo "Shutdown mw-qserve"
	return "$RETVAL"
}

do_stop_nslave() {
	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE_NSLAVE --name $NAME_NSLAVE
	RETVAL="$?"
	[ "$RETVAL" = 2 ] && return 2

	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON_NSLAVE
	[ "$?" = 2 ] && return 2
	rm -f $PIDFILE_NSLAVE
	echo "Shutdown nslave"
	return "$RETVAL"
}

#
# Concat Function start stop status reload
#

do_start() {
	do_start_nserve
	if [ "$?" = 2 ]
	then
		echo "error Starting $NAME_NSERVE"
	else
		do_start_mw_qserve
		if [ "$?" -gt 2 ]
		then
			echo "error Starting $NAME_MWQSERVE"
		else
			do_start_nslave
			if [ "$?" -gt 2 ]
			then
				echo "error Starting $NAME_MWQSERVE"
			fi
		fi
	fi
	return 0
}

do_stop() {
	do_stop_nserve
	if [ "$?" = 2 ] 
	then
		echo "error kill $NAME_NSERVE"
		return 2
	else
		do_stop_mw_qserve
		if [ "$?" = 2 ] 
		then
			echo "error kill $NAME_MWQSERVE"
			return 2
		else
			do_stop_nslave
			if [ "$?" = 2 ] 
			then
				echo "error kill $NAME_MWQSERVE"
				return 2
			fi
		fi
	fi
	return 0
}


case "$1" in
  start)
	do_start
	;;
  stop)
	do_stop
	;;
  restart|force-reload)
	do_stop
	do_start
	;;
  *)
	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
	exit 3
	;;
esac
:

Reply via email to