View | Details | Raw Unified | Return to bug 111749
Collapse All | Expand All

(-)daemontools_new/files/svscan_to_multilog.sh (+33 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
# A tool to change from standard daemontools svscan setup on FreeBSD
4
# which uses readproctitle to a setup where svscan logs to multilog.
5
# If you define a svscan_logdir in your rc.conf, then you need to either 
6
# define it here or create the dir afterwards.
7
8
svscan_logdir=${svscan_logdir-"/var/log/svscan"}
9
echo "Creating $svscan_logdir"
10
mkdir -p "$svscan_logdir" || exit -1
11
chmod a+rx "$svscan_logdir"
12
13
patch -p0 '/usr/local/etc/rc.d/svscan.sh' <<'EOF'
14
@@ -50,6 +50,9 @@
15
 command="/usr/local/bin/svscan"
16
 svscan_enable=${svscan_enable-"NO"}
17
 svscan_servicedir=${svscan_servicedir-"/var/service"}
18
+svscan_logdir=${svscan_logdir-"/var/log/svscan"}
19
+svscan_logmax=${svscan_logmax-"10485760"}
20
+svscan_lognum=${svscan_lognum-"9"}
21
 
22
 start_cmd="svscan_start"
23
 stop_postcmd="svscan_stop_post"
24
@@ -62,7 +65,7 @@
25
 	echo "Starting svscan."
26
 	/usr/bin/env \
27
 	PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
28
-	/usr/sbin/daemon -f /bin/sh -c "$command $svscan_servicedir 2>&1 | /usr/local/bin/readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................ &" > /dev/null
29
+	/usr/sbin/daemon -f /bin/sh -c "$command $svscan_servicedir 2>&1 | /usr/local/bin/multilog t s$svscan_logmax n$svscan_lognum $svscan_logdir &" > /dev/null
30
 }
31
 
32
 svscan_stop_post () {
33
EOF

Return to bug 111749