AWS Thinkbox Discussion Forums

chkconfig: DL Launcher Servce init script

Hi,
just wanted to share a modified version of the init.d script with ships with DL6 Beta to support chkconfig and all the fancy [OK] and [FAILED] messages. I modified (shorted) the name purely for readability reasons with chkconfig.
After putting the file in /etc/init.d/dl6laucherd use:

/etc/inid.d/deadlinelauncherservice stop
chkconfig --add dl6launcherd
chkconfig dl6launcherd on
service dl6launcherd start
rm /etc/inid.d/deadlinelauncherservice
------
chkconfig --list | grep dl6
    dl6launcherd      	0:off	1:off	2:off	3:on	4:on	5:on	6:off

On the next system boot you should see the daemon start like all other services and fairly the last process getting started. I tested this on CentOS6 and RHEL6. It should work on RHEL5/CentOS5 and on Fedora (were this is automatically converted to systemd)

Here the contents of the init.d script:

#!/bin/bash
# dl6launcherd
# chkconfig: 345 99 99
# desc: Handles remote communication between Deadline Clients
### BEGIN INIT INFO
# Provides: dl6launcherd
# Required-Start:
# Defalt-Start: 3 4 5
# Default-Stop: 0 1 6
# Description: Handles remote communication between Deadline Clients
### END INIT INFO


# Source function library.
. /etc/init.d/functions

DEADLINEBIN=/opt/Thinkbox/Deadline6/bin
LOGFILE="/var/log/deadlinelauncherservice.log"
PIDFILE="/var/run/deadlinelauncherservice.pid"

touch $PIDFILE

start () {
	pid=`cat $PIDFILE`
	if [ -n "$pid" ]; then
		echo "Deadline Launcher Service already running"
		echo
		exit 4
	else
		echo -n "Starting Deadline 6"
		# Start the Deadline Launcher in headless mode.
		if [ -x "$DEADLINEBIN/deadlinelauncher" ]; then
			"$DEADLINEBIN/deadlinelauncher" -nogui >> "$LOGFILE" 2>&1 < /dev/null & 
			echo $! > $PIDFILE
			success; echo
			#echo "Deadline Launcher Service Started"
			exit 0
		else
			echo -n "Could not find deadlinelauncher"
			failure; echo; return 1
			exit 2
		fi
	fi
}

stop () {
	pid=`cat $PIDFILE`
	if [ -n "$pid" ]; then
		echo -n  "Stopping Deadline Launcher Service"
		# Try shutting down the Deadline Launcher gracefully first, then kill if necessary.
		if [ -x "$DEADLINEBIN/deadlinelauncher" ]; then
			"$DEADLINEBIN/deadlinelauncher" -s >> "$LOGFILE" 2>&1 < /dev/null
		fi
		kill $pid
		rm $PIDFILE
		success; echo
		exit 0
	else
		echo -n "Deadline Launcher Service is not running"
		failure; echo; return 1
		exit 3
	fi
}

# See how we were called.
case "$1" in 
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac
Privacy | Site terms | Cookie preferences