summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Friloux <guillaume.friloux@gmail.com>2014-01-07 15:39:44 +0100
committerGuillaume Friloux <guillaume.friloux@gmail.com>2014-01-07 15:39:44 +0100
commit05c394bb8b50c30644b4c27a080190c2597f8c1b (patch)
treeca55780b971f4ac1bfa83c3e6d9a6a34f670589a
parentfeedcc4919feb92fb81f087b1c1b92fa958179eb (diff)
Add init script for debian.
-rw-r--r--configure.ac1
-rw-r--r--debian/smman.init.in61
-rw-r--r--debian/smman.postinst10
-rw-r--r--debian/smman.postrm12
-rw-r--r--debian/smman.prerm13
5 files changed, 97 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 10284f5..fb9d76c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,7 @@ AC_CONFIG_HEADER([config.h])
69 69
70AC_OUTPUT([ 70AC_OUTPUT([
71doc/smman.dox 71doc/smman.dox
72debian/smman.init
72]) 73])
73 74
74echo 75echo
diff --git a/debian/smman.init.in b/debian/smman.init.in
new file mode 100644
index 0000000..1d963fd
--- /dev/null
+++ b/debian/smman.init.in
@@ -0,0 +1,61 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: smman
4# Required-Start: $syslog
5# Required-Stop: $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Start Smman the syslog manager.
9# Description: Start Smman the syslog manager.
10### END INIT INFO
11
12DAEMON=@prefix@/bin/smman
13DESC="smman"
14
15. /lib/lsb/init-functions
16
17if [ -f @sysconfdir@/default/smman ] ; then
18 . @sysconfdir@/default/smman
19fi
20set -e
21do_start() {
22 start-stop-daemon --start --background --oknodo --exec $DAEMON -- $DAEMON_OPTS
23}
24
25do_stop() {
26 start-stop-daemon --stop --oknodo --quiet --exec $DAEMON --signal 9
27}
28
29do_restart() {
30 start-stop-daemon --stop --oknodo --quiet --exec $DAEMON --signal USR1
31}
32
33case "$1" in
34 start)
35 log_daemon_msg "Starting $PROGRAM"
36 do_start
37 log_end_msg $?
38 ;;
39 stop)
40 log_daemon_msg "Stopping $PROGRAM"
41 do_stop
42 log_end_msg $?
43 ;;
44 restart|force-reload)
45 log_daemon_msg "Restarting $PROGRAM"
46 do_stop
47 sleep 1
48 do_start
49 log_end_msg $?
50 ;;
51 reload)
52 log_daemon_msg "Reloading $PROGRAM"
53 do_restart
54 log_end_msg $?
55 *)
56 log_success_msg "Usage: $0 {start|stop|restart|force-reload|reload}" >&2
57 exit 1
58 ;;
59esac
60
61exit 0
diff --git a/debian/smman.postinst b/debian/smman.postinst
new file mode 100644
index 0000000..4ca8bbf
--- /dev/null
+++ b/debian/smman.postinst
@@ -0,0 +1,10 @@
1#!/bin/bash
2
3set -e
4case "$1" in
5 configure)
6 update-rc.d smman start 28 2 3 4 5 . stop 28 0 1 6 .
7 /etc/init.d/smman restart
8 ;;
9esac
10exit 0
diff --git a/debian/smman.postrm b/debian/smman.postrm
new file mode 100644
index 0000000..c806eff
--- /dev/null
+++ b/debian/smman.postrm
@@ -0,0 +1,12 @@
1#!/bin/sh
2
3set -e
4
5case "$1" in
6 remove|purge)
7 update-rc.d -f smman remove
8 ;;
9esac
10
11exit 0
12
diff --git a/debian/smman.prerm b/debian/smman.prerm
new file mode 100644
index 0000000..a79c053
--- /dev/null
+++ b/debian/smman.prerm
@@ -0,0 +1,13 @@
1#!/bin/sh
2
3set -e
4
5case "$1" in
6 remove)
7 RESULT=0
8 invoke-rc.d smman stop
9 ;;
10esac
11
12exit 0
13