Date: Mon, 16 Apr 2007 23:56:25 GMT From: Andrew Hammond<andrew.george.hammond@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/111749: sysutils/daemontools svscan output to multilog would be a nice option Message-ID: <200704162356.l3GNuP8e087493@www.freebsd.org> Resent-Message-ID: <200704170010.l3H0A0dP009522@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 111749 >Category: ports >Synopsis: sysutils/daemontools svscan output to multilog would be a nice option >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Apr 17 00:10:00 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Andrew Hammond >Release: 6.2/amd64 >Organization: >Environment: FreeBSD ahammond.ecoffice.experclick.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 08:43:30 UTC 2007 root@portnoy.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP amd64 >Description: Per http://www.thedjbway.org/svscanboot.html it is sometimes a nice idea to have the output of svscan piped into multilog instead of readproctitle. The attached shell script alters rc.d/svscan.sh to do this. I'm sure that having it as a configure option would be better, but I don't know how to do that. >How-To-Repeat: >Fix: Patch attached with submission follows: diff -ruN daemontools/files/svscan_to_multilog.sh daemontools_new/files/svscan_to_multilog.sh --- daemontools/files/svscan_to_multilog.sh Thu Jan 1 00:00:00 1970 +++ daemontools_new/files/svscan_to_multilog.sh Mon Apr 16 23:45:28 2007 @@ -0,0 +1,33 @@ +#!/bin/sh + +# A tool to change from standard daemontools svscan setup on FreeBSD +# which uses readproctitle to a setup where svscan logs to multilog. +# If you define a svscan_logdir in your rc.conf, then you need to either +# define it here or create the dir afterwards. + +svscan_logdir=${svscan_logdir-"/var/log/svscan"} +echo "Creating $svscan_logdir" +mkdir -p "$svscan_logdir" || exit -1 +chmod a+rx "$svscan_logdir" + +patch -p0 '/usr/local/etc/rc.d/svscan.sh' <<'EOF' +@@ -50,6 +50,9 @@ + command="/usr/local/bin/svscan" + svscan_enable=${svscan_enable-"NO"} + svscan_servicedir=${svscan_servicedir-"/var/service"} ++svscan_logdir=${svscan_logdir-"/var/log/svscan"} ++svscan_logmax=${svscan_logmax-"10485760"} ++svscan_lognum=${svscan_lognum-"9"} + + start_cmd="svscan_start" + stop_postcmd="svscan_stop_post" +@@ -62,7 +65,7 @@ + echo "Starting svscan." + /usr/bin/env \ + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ +- /usr/sbin/daemon -f /bin/sh -c "$command $svscan_servicedir 2>&1 | /usr/local/bin/readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................ &" > /dev/null ++ /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 + } + + svscan_stop_post () { +EOF >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704162356.l3GNuP8e087493>