File: coherence-initscript.sh

package info (click to toggle)
coherence 0.5.8-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,796 kB
  • ctags: 2,441
  • sloc: python: 16,059; xml: 5,176; sh: 59; makefile: 21
file content (94 lines) | stat: -rw-r--r-- 1,569 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
#
#	/etc/rc.d/init.d/coherence
#
# Starts the coherence server
#
# chkconfig: 345 90 56
# description: An UPnP/DLNA MediaServer
# processname: coherence
# securlevel: 80
#
### BEGIN INIT INFO
# Provides: coherence
# Default-Start: 3 4 5
# Required-Start: $network messagebus
# Required-Stop: $network messagebus
# Short-Description: Starts the coherence server
# Description: An UPnP/DLNA MediaServer
### END INIT INFO

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

PROGNAME=coherence
CONFIGFILE=/etc/coherence/coherence.conf
LOGFILE=/var/log/coherence
test -x /usr/bin/$PROGNAME || exit 0

RETVAL=0

#
# See how we were called.
#

start() {
	# Check if it is already running
	if [ ! -f /var/lock/subsys/$PROGNAME ]; then
	    gprintf "Starting %s daemon: " "$DAEMON"
	    daemon python /usr/bin/$PROGNAME -d -c $CONFIGFILE -l $LOGFILE
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROGNAME
	    echo
	fi
	return $RETVAL
}

stop() {
	gprintf "Stopping %s daemon: " "$DAEMON"
	killproc python /usr/bin/$PROGNAME
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROGNAME
	echo
        return $RETVAL
}


restart() {
	$0 stop
	$0 start
}	

reload() {
	trap "" SIGHUP
	killall -HUP $PROGNAME
}	

case "$1" in
start)
	start
	;;
stop)
	stop
	;;
reload)
	reload
	;;
restart)
	restart
	;;
condrestart)
	if [ -f /var/lock/subsys/$PROGNAME ]; then
	    restart
	fi
	;;
status)
	status $PROGNAME 
	;;
*)
	INITNAME=`basename $0`
	gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" "$INITNAME"
	exit 1
esac

exit $RETVAL