Hi, I've written an init script for swatch (the simple logfile watcher). Hope you like it, I do already. ;) Greetings, Phil PS: Sorry for the ugly pasting that follows, but I can't find this "attach file" button. Shouldn't there be one? --------- START /etc/conf.d/swatch ------------- # Path to the swatch program. Default should fit. #SWATCH_BINARY="/usr/bin/swatch" # Swatchrc to read patterns and actions from. #SWATCHRC="/etc/swatchrc" # The actual file to parse. LOGFILE="/var/log/lighttpd/access.log" # Where to output the generated script to. Should not be writable by others. #SWATCH_SCRIPT="/var/run/swatch_script.pl" # Whether to parse the complete file once at startup. Defaults to "NO". PARSE_FULL="YES" --------- END /etc/conf.d/swatch ------------- --------- START /etc/init.d/swatch ----------- #!/sbin/runscript # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # some notes on the swatch init script: # - Per default, swatch generates a perl script with some random # prefix and calls perl internally. To prevent cluttering the # filesystem with temporary scripts, the following uses a two # step aproach: first output the script to a defined name, and # then call perl manually. # - This init script forcibly uses the option '--use-cpan-file-tail', # as otherwise the generated perl script would use system() to # call the tail binary, leading to a perl process not reacting on # any signal (the tail process has to be killed in that case). depend() { need logger } SWATCH_BINARY=${SWATCH_BINARY:-/usr/bin/swatch} SWATCHRC=${SWATCH_CONFIG:-/etc/swatchrc} LOGFILE=${LOGFILE:-/var/log/syslog} SWATCH_SCRIPT=${SWATCH_SCRIPT:-/var/run/swatch_script.pl} gen_script() { # (-t|-f) ebegin "Generating watch script from config" ${SWATCH_BINARY} --dump-script="${SWATCH_SCRIPT}" \ --use-cpan-file-tail -c "${SWATCHRC}" \ $1 "${LOGFILE}" eend $? } parse_full() { gen_script -f ebegin "Parsing complete file once" /usr/bin/perl ${SWATCH_SCRIPT} 1>/dev/null eend $? } start() { if [ x"$PARSE_FULL" == xYES ]; then parse_full fi gen_script -t ebegin "Starting swatch" start-stop-daemon --start --quiet --background \ --make-pidfile --pidfile /var/run/swatch.pid \ --exec /usr/bin/perl -- ${SWATCH_SCRIPT} eend $? } stop() { ebegin "Stopping swatch" start-stop-daemon --stop --exec /usr/bin/perl \ --pidfile /var/run/swatch.pid --quiet eend $? } --------- END /etc/init.d/swatch -----------
Thanks for submitting your init script :) For future reference, the attachment link you were looking for is called "Create a new attachment" and is inside the little table below the "keywords" field in the bug form. Since there is currently no maintainer for this package, I'll go ahead and take this bug and give your init script a try.
(In reply to comment #1) > Thanks for submitting your init script :) No problem, thanks for taking care of it in return. ;) > For future reference, the attachment link you were looking for is called > "Create a new attachment" and is inside the little table below the "keywords" > field in the bug form. Hmm. Seems like the little table you mention exists only when displaying an existing bug, not in the mask for new ones. (Please note that I used the "Ex" link under "Actions", but as far as I've checked the wizzard seems not to offer file attachments, either. Maybe it's possible to add a note to the bug creation mask, saying that files can be attached after the bug has been created. Greetings, Phil
Init script included in app-admin/swatch-3.2.3-r1. Requested stabilization of this version in bug #379961 Thanks for your work!