aboutsummaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/mauvealert-server.init22
-rw-r--r--debian/mauvealert-server.logrotate10
-rw-r--r--debian/mauvealert-server.postinst20
-rw-r--r--debian/mauvealert-server.postrm23
4 files changed, 70 insertions, 5 deletions
diff --git a/debian/mauvealert-server.init b/debian/mauvealert-server.init
index 1f0e57f..15c287b 100644
--- a/debian/mauvealert-server.init
+++ b/debian/mauvealert-server.init
@@ -32,8 +32,6 @@ SCRIPTNAME=/etc/init.d/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
-VERBOSE=1
-
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
@@ -48,9 +46,9 @@ do_start()
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
- start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON --chuid $RUNASUSER --test > /dev/null \
|| return 1
- start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --startas $DAEMON -- \
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --chuid $RUNASUSER --background --startas $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
@@ -95,10 +93,19 @@ do_reload() {
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
- start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --name $NAME
return 0
}
+#
+# Function that sends a SIGUSR1 to reopen logfiles
+#
+do_reopenlogs() {
+ start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
@@ -128,6 +135,11 @@ case "$1" in
do_reload
log_end_msg $?
;;
+ reopen-logs)
+ log_daemon_msg "Re-opening logs for $DESC" "$NAME"
+ do_reopenlogs
+ log_end_msg $?
+ ;;
restart)
#
# If the "reload" option is implemented then remove the
diff --git a/debian/mauvealert-server.logrotate b/debian/mauvealert-server.logrotate
new file mode 100644
index 0000000..3885a35
--- /dev/null
+++ b/debian/mauvealert-server.logrotate
@@ -0,0 +1,10 @@
+/var/log/mauvealert.log {
+ rotate 7
+ daily
+ compress
+ delaycompress
+ postrotate
+ /usr/sbin/invoke-rc.d mauvealert-server reopen-logs >/dev/null
+ endscript
+}
+
diff --git a/debian/mauvealert-server.postinst b/debian/mauvealert-server.postinst
new file mode 100644
index 0000000..3d1c09a
--- /dev/null
+++ b/debian/mauvealert-server.postinst
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -e
+
+##
+# Add a mauve user
+##
+RUNASUSER=mauvealert
+
+adduser --system --no-create-home --home /nonexistent $RUNASUSER > /dev/null
+
+##
+# Add default directories
+##
+for i in log lib ; do
+ mkdir -p /var/$i/mauvealert
+ chown -R $RUNASUSER:nogroup /var/$i/mauvealert
+done
+
+#DEBHELPER#
diff --git a/debian/mauvealert-server.postrm b/debian/mauvealert-server.postrm
new file mode 100644
index 0000000..24fd158
--- /dev/null
+++ b/debian/mauvealert-server.postrm
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+##
+# Add a mauve user
+##
+RUNASUSER=mauvealert
+
+if [ "$1" = "purge" ] ; then
+ ##
+ # Remove the system user
+ ##
+ deluser --system $RUNASUSER > /dev/null
+
+ ##
+ # remove default directories
+ ##
+ rm -rf /var/log/mauvealert/
+ rm -rf /var/lib/mauvealert/
+fi
+
+#DEBHELPER#