+

Redirect all wifidog output in a logfile

Benjamin Renard [2013-08-14 10:56:46]
Redirect all wifidog output in a logfile
Filename
rules
wifidog-gateway.default
wifidog-gateway.init
wifidog-gateway.logrotate
diff --git a/rules b/rules
index f329b5e..316a65e 100755
--- a/rules
+++ b/rules
@@ -76,7 +76,7 @@ binary-arch: build install
 #	dh_install
 #	dh_installmenu
 #	dh_installdebconf
-#	dh_installlogrotate
+	dh_installlogrotate
 #	dh_installemacsen
 #	dh_installpam
 #	dh_installmime
diff --git a/wifidog-gateway.default b/wifidog-gateway.default
index ca668b8..1f7736f 100644
--- a/wifidog-gateway.default
+++ b/wifidog-gateway.default
@@ -4,6 +4,9 @@
 # Wifidog Gateway configuration file
 #DAEMON_CONF=/etc/wifidog.conf

+# Log file
+#LOG_FILE=/var/log/wifidog
+
 # Log level (0=emerg, 1=alert, 2=crit, 3=err, 4=warn, 5=notice, 6=info, 7=debug)
 #LOG_LEVEL=6

diff --git a/wifidog-gateway.init b/wifidog-gateway.init
index 7316558..df17abb 100755
--- a/wifidog-gateway.init
+++ b/wifidog-gateway.init
@@ -13,6 +13,7 @@ DAEMON_BIN=/usr/bin/wifidog
 WDCTL_BIN=/usr/bin/wdctl
 DAEMON_DEFS=/etc/default/wifidog-gateway
 DAEMON_CONF=/etc/wifidog.conf
+LOG_FILE=/var/log/wifidog
 LOG_LEVEL=6
 OPTIONS=""
 NAME=wifidog-gateway
@@ -30,12 +31,12 @@ DAEMON_OPTS="-c $DAEMON_CONF -s -d $LOG_LEVEL"
 case "$1" in
 	start)
 		log_daemon_msg "Starting $DESC" "$NAME"
-		start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_BIN" -- $DAEMON_OPTS
+		start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_BIN" -- $DAEMON_OPTS > $LOG_FILE 2>&1
 		log_end_msg "$?"
 		;;
 	stop)
 		log_daemon_msg "Stopping $DESC" "$NAME"
-		start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_BIN"
+		start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_BIN" > $LOG_FILE 2>&1
 		log_end_msg "$?"
 		;;
 	restart|reload|force-reload)
diff --git a/wifidog-gateway.logrotate b/wifidog-gateway.logrotate
new file mode 100644
index 0000000..b4fc3dd
--- /dev/null
+++ b/wifidog-gateway.logrotate
@@ -0,0 +1,11 @@
+/var/log/wifidog {
+	weekly
+	missingok
+	rotate 4
+	compress
+	delaycompress
+	notifempty
+	create 640 root adm
+	sharedscripts
+	copytruncate
+}
ViewGit