summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDane Smith <c1pher@gentoo.org>2011-07-06 12:23:00 +0000
committerDane Smith <c1pher@gentoo.org>2011-07-06 12:23:00 +0000
commit2e9772bf7581840905277d49f57bb3e533c84645 (patch)
treefc064cb2f048545025db76a36a03f3e44cecda78 /app-admin/swatch/files
parentVersion bump. Drop older. (diff)
downloadhistorical-2e9772bf7581840905277d49f57bb3e533c84645.tar.gz
historical-2e9772bf7581840905277d49f57bb3e533c84645.tar.bz2
historical-2e9772bf7581840905277d49f57bb3e533c84645.zip
app-admin/swatch: Revision bump. Add init and conf scripts. Update maintainer info.
Package-Manager: portage-2.2.0_alpha43/cvs/Linux x86_64
Diffstat (limited to 'app-admin/swatch/files')
-rw-r--r--app-admin/swatch/files/swatch-confd25
-rw-r--r--app-admin/swatch/files/swatch-initd52
2 files changed, 77 insertions, 0 deletions
diff --git a/app-admin/swatch/files/swatch-confd b/app-admin/swatch/files/swatch-confd
new file mode 100644
index 000000000000..813a2a084fc7
--- /dev/null
+++ b/app-admin/swatch/files/swatch-confd
@@ -0,0 +1,25 @@
+# /etc/conf.d/swatch: config file for /etc/init.d/swatch
+
+# Path to the swatch program.
+#SWATCH_BINARY="/usr/bin/swatch"
+
+# Swatchrc to read patterns and actions from.
+#SWATCHRC="/etc/swatchrc"
+
+# File to monitor
+#SWATCH_TAILFILE="/var/log/syslog"
+
+# Arguments to tail program
+#SWATCH_TAILARGS=""
+
+# Swatch log file
+#SWATCH_LOGFILE="/var/log/swatch.log"
+
+# Swatch error file
+#SWATCH_ERRFILE="/var/log/swatch-err.log"
+
+# Where to output the generated script to. Should not be writable by others.
+#SWATCH_SCRIPT="/var/run/swatch/swatch_script.pl"
+
+# Whether to parse the complete file once at startup. Defaults to "NO".
+PARSE_FULL="NO"
diff --git a/app-admin/swatch/files/swatch-initd b/app-admin/swatch/files/swatch-initd
new file mode 100644
index 000000000000..f1a25a66a209
--- /dev/null
+++ b/app-admin/swatch/files/swatch-initd
@@ -0,0 +1,52 @@
+#!/sbin/runscript
+# This script is based on the one created by Phil (bug #255329).
+
+depend() {
+ need logger
+}
+
+SWATCH_BINARY=${SWATCH_BINARY:-/usr/bin/swatch}
+SWATCHRC=${SWATCHRC:-/etc/swatchrc}
+SWATCH_TAILFILE=${SWATCH_TAILFILE:-/var/log/syslog}
+SWATCH_LOGFILE=${SWATCH_LOGFILE:-/var/log/swatch.log}
+SWATCH_ERRFILE=${SWATCH_ERRFILE:-/var/log/swatch-err.log}
+SWATCH_SCRIPT=${SWATCH_SCRIPT:-/var/run/swatch/swatch_script.pl}
+
+gen_script() {
+ local tailargs=""
+ if [ "${SWATCH_TAILARGS}" ]; then
+ tailargs="--tail-args=\"${SWATCH_TAILARGS}\""
+ fi
+ ebegin "Generating swatch script from config"
+ ${SWATCH_BINARY} --dump-script="${SWATCH_SCRIPT}" \
+ --use-cpan-file-tail ${tailargs} \
+ --config-file "${SWATCHRC}" $1 "${SWATCH_TAILFILE}"
+ eend $?
+}
+
+parse_full() {
+ gen_script --examine
+ ebegin "Parsing complete file once"
+ /usr/bin/perl ${SWATCH_SCRIPT} 1>/dev/null
+ eend $?
+}
+
+start() {
+ if [ "${PARSE_FULL}" == "YES" ]; then
+ parse_full
+ fi
+ gen_script --tail-file
+ ebegin "Starting swatch"
+ start-stop-daemon --start --quiet --background \
+ --make-pidfile --pidfile /var/run/swatch/swatch.pid \
+ --stdout ${SWATCH_LOGFILE} --stderr ${SWATCH_ERRFILE} \
+ --exec /usr/bin/perl -- ${SWATCH_SCRIPT}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping swatch"
+ start-stop-daemon --stop --exec /usr/bin/perl \
+ --pidfile /var/run/swatch/swatch.pid --quiet
+ eend $?
+}