1#!/bin/sh
2#
3### BEGIN INIT INFO
4# Provides:          freediameter
5# Default-Start:     2 3 4 5
6# Default-Stop:      0 1 6
7# Required-Start:    $remote_fs $syslog
8# Required-Stop:     $remote_fs $syslog
9# Short-Description: Start freeDiameter daemon at boot time
10# Description:       Start the freeDiameter daemon at boot time.
11#       freeDiameter is an extensible implementation of the Diameter protocol,
12#       designed for Authentication, Authorization and Accounting. Diameter is
13#       an evolution of the RADIUS protocol.
14### END INIT INFO#
15DAEMON=/usr/bin/freeDiameterd
16CONF=/etc/freeDiameter/freeDiameter.conf
17NAME=freediameter
18DESC="freeDiameter daemon"
19
20. /etc/init.d/functions
21start() {
22	[ -x $DAEMON ] || exit 5
23	echo -n $"Starting $DAEMON: "
24	start-stop-daemon -S -b -x ${DAEMON} && success || failure
25	retval=$?
26	echo ""
27	return $retval
28}
29
30stop() {
31	echo -n $"Stopping $prog: "
32	start-stop-daemon -K -x $DAEMON
33	retval=$?
34	echo ""
35	return $retval
36}
37
38restart() {
39	stop
40	sleep 3
41	start
42}
43
44rh_status() {
45	status $DAEMON
46}
47
48rh_status_q() {
49	rh_status > /dev/null 2>&1
50}
51
52case "$1" in
53  start)
54	rh_status_q && exit 0
55	start
56	;;
57  stop)
58	rh_status_q || exit 0
59	stop
60	;;
61  restart)
62	restart
63	;;
64  status)
65	rh_status
66	;;
67  *)
68	echo $"Usage: $prog {start|stop|status|restart}"
69	exit 2
70esac
71
72exit $?
73