Projet

Général

Profil

Télécharger (2,32 ko) Statistiques
| Branche: | Tag: | Révision:

root / debian / wcs-au-quotidien.init @ ac94988a

1
#! /bin/sh
2
### BEGIN INIT INFO
3
# Provides:          wcs-auquotidien
4
# Required-Start:    $local_fs $network
5
# Required-Stop:     $local_fs $network
6
# Default-Start:     2 3 4 5
7
# Default-Stop:      0 1 6
8
# Short-Description: w.c.s. (Au quotidien)
9
# Description:       w.c.s. Form Server (with Au Quotidien Extension)
10
### END INIT INFO
11

    
12
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
13
DESC="w.c.s. (+Au Quotidien)"
14
NAME=wcs-auquotidien
15
DAEMON=/usr/sbin/wcsctl
16
PIDFILE=/var/run/$NAME.pid
17
SCRIPTNAME=/etc/init.d/$NAME
18
PYTHON_VERSION=`/usr/bin/env python -c \
19
    "import sys; print '%d.%d' % (sys.version_info[0], sys.version_info[1])"`
20
OPTIONS="--extra /usr/lib/pymodules/python$PYTHON_VERSION/extra-wcs-au-quotidien/"
21
WCS_USER=wcs-au-quotidien
22
WCS_GROUP=wcs-au-quotidien
23

    
24
# Gracefully exit if the package has been removed.
25
test -x $DAEMON || exit 0
26

    
27
# Read config file if it is present.
28
if [ -r /etc/default/$NAME ]
29
then
30
	. /etc/default/$NAME
31
fi
32

    
33
#
34
#	Function that starts the daemon/service.
35
#
36
d_start() {
37
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
38
		--chuid $WCS_USER:$WCS_GROUP \
39
		--make-pidfile --background --exec $DAEMON -- start $OPTIONS
40
}
41

    
42
#
43
#	Function that stops the daemon/service.
44
#
45
d_stop() {
46
	start-stop-daemon --stop --quiet --pidfile $PIDFILE
47
}
48

    
49
#
50
#	Function that sends a SIGHUP to the daemon/service.
51
#
52
d_reload() {
53
	start-stop-daemon --stop --quiet --pidfile $PIDFILE \
54
		--make-pidfile --background --signal 1
55
}
56

    
57
case "$1" in
58
  start)
59
	echo -n "Starting $DESC: $NAME"
60
	d_start
61
	echo "."
62
	;;
63
  stop)
64
	echo -n "Stopping $DESC: $NAME"
65
	d_stop
66
	echo "."
67
	;;
68
  #reload)
69
	#
70
	#	If the daemon can reload its configuration without
71
	#	restarting (for example, when it is sent a SIGHUP),
72
	#	then implement that here.
73
	#
74
	#	If the daemon responds to changes in its config file
75
	#	directly anyway, make this an "exit 0".
76
	#
77
	# echo -n "Reloading $DESC configuration..."
78
	# d_reload
79
	# echo "done."
80
  #;;
81
  restart|force-reload)
82
	#
83
	#	If the "reload" option is implemented, move the "force-reload"
84
	#	option to the "reload" entry above. If not, "force-reload" is
85
	#	just the same as "restart".
86
	#
87
	echo -n "Restarting $DESC: $NAME"
88
	d_stop
89
	sleep 1
90
	d_start
91
	echo "."
92
	;;
93
  *)
94
	# echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
95
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
96
	exit 1
97
	;;
98
esac
99

    
100
exit 0
(8-8/8)