Redirect all wifidog output in a logfile
Benjamin Renard

Benjamin Renard commited on 2013-08-14 10:56:46
Showing 4 changed files, with 18 additions and 3 deletions.

... ...
@@ -76,7 +76,7 @@ binary-arch: build install
76 76
 #	dh_install
77 77
 #	dh_installmenu
78 78
 #	dh_installdebconf	
79
-#	dh_installlogrotate
79
+	dh_installlogrotate
80 80
 #	dh_installemacsen
81 81
 #	dh_installpam
82 82
 #	dh_installmime
... ...
@@ -4,6 +4,9 @@
4 4
 # Wifidog Gateway configuration file 
5 5
 #DAEMON_CONF=/etc/wifidog.conf
6 6
 
7
+# Log file
8
+#LOG_FILE=/var/log/wifidog
9
+
7 10
 # Log level (0=emerg, 1=alert, 2=crit, 3=err, 4=warn, 5=notice, 6=info, 7=debug)
8 11
 #LOG_LEVEL=6
9 12
 
... ...
@@ -13,6 +13,7 @@ DAEMON_BIN=/usr/bin/wifidog
13 13
 WDCTL_BIN=/usr/bin/wdctl
14 14
 DAEMON_DEFS=/etc/default/wifidog-gateway
15 15
 DAEMON_CONF=/etc/wifidog.conf
16
+LOG_FILE=/var/log/wifidog
16 17
 LOG_LEVEL=6
17 18
 OPTIONS=""
18 19
 NAME=wifidog-gateway
... ...
@@ -30,12 +31,12 @@ DAEMON_OPTS="-c $DAEMON_CONF -s -d $LOG_LEVEL"
30 31
 case "$1" in
31 32
 	start)
32 33
 		log_daemon_msg "Starting $DESC" "$NAME"
33
-		start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_BIN" -- $DAEMON_OPTS
34
+		start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_BIN" -- $DAEMON_OPTS > $LOG_FILE 2>&1
34 35
 		log_end_msg "$?"
35 36
 		;;
36 37
 	stop)
37 38
 		log_daemon_msg "Stopping $DESC" "$NAME"
38
-		start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_BIN"
39
+		start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_BIN" > $LOG_FILE 2>&1
39 40
 		log_end_msg "$?"
40 41
 		;;
41 42
 	restart|reload|force-reload)
... ...
@@ -0,0 +1,11 @@
1
+/var/log/wifidog {
2
+	weekly
3
+	missingok
4
+	rotate 4
5
+	compress
6
+	delaycompress
7
+	notifempty
8
+	create 640 root adm
9
+	sharedscripts
10
+	copytruncate
11
+}
0 12