# X-UnitedLinux-Should-Start: portmap
# Should-Start: portmap
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: EMC Networker. A backup and restoration software package.

### END INIT INFO

case $1 in
    start)
	(echo 'starting NetWorker daemons:') > /dev/console
	LD_LIBRARY_PATH=/usr/lib/nsr/lib64:$LD_LIBRARY_PATH
	export LD_LIBRARY_PATH
	if [ -f /usr/sbin/nsrexecd ]; then
		if [ -f /usr/sbin/NetWorker.clustersvr ]; then
			if [ -f /nsr.NetWorker.local -o \
			    -h /nsr.NetWorker.local ]; then
				if [ -h /nsr ]; then
					rm -f /nsr
					ln -s /nsr.NetWorker.local /nsr
				fi
			fi
		fi
		(/usr/sbin/nsrexecd -s backup.cs) 2>&1 | /usr/bin/tee /dev/console
		(echo ' nsrexecd') > /dev/console
	fi
	if [ -f /usr/sbin/lgtolmd ]; then
		(/usr/sbin/lgtolmd -p /nsr/lic -n 1) 2>&1 | \
			/usr/bin/tee /dev/console
		(echo ' lgtolmd') > /dev/console
	fi
	if [ -f /usr/sbin/nsrd -a \
	     ! -f /usr/sbin/NetWorker.clustersvr ]; then
		(/usr/sbin/nsrd) 2>&1 | /usr/bin/tee /dev/console
		(echo ' nsrd') > /dev/console
	fi
	;;
    stop)
	(echo 'stopping NetWorker daemons:') > /dev/console
	if [ -f /usr/sbin/nsr_shutdown ]; then
		if [ -f /usr/sbin/NetWorker.clustersvr ]; then
			(/usr/sbin/nsr_shutdown -q) 2>&1 | \
				/usr/bin/tee /dev/console
			(echo ' nsr_shutdown -q') > /dev/console
		else
			(/usr/sbin/nsr_shutdown -q) 2>&1 | \
				/usr/bin/tee /dev/console
			(echo ' nsr_shutdown -q') > /dev/console
		fi
	fi
	;;
    status)
	if [ -f /usr/sbin/nsr_shutdown ]; then
		/usr/sbin/nsr_shutdown -l
	fi
	;;
    *)
	echo "usage: `basename $0` {start|stop|status}"
	;;
esac