summaryrefslogtreecommitdiff
path: root/security/swatch/files/swatch.in
blob: a81590fcff24cb59f6c0f0dce06e8b8d38783865 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: swatch
# REQUIRE: DAEMON
#
# To enable multiple instance of swatch, add lines like below to
# /etc/rc.conf.
#
# swatch_enable="YES"
# swatch_rules="1 2 3"
# swatch_1_flags="--config-file=/rc --tail-file=/log --daemon --pid-file=/pid"
# swatch_1_user="nobody"
# swatch_1_chdir="/var/tmp"
# swatch_1_pidfile="/pid"
# swatch_2_flags="blah, blah"
# swatch_3_flags="blah, blah"

. /etc/rc.subr

name=swatch
rcvar=`set_rcvar`

command=%%PREFIX%%/bin/swatch
procname=%%LOCALBASE%%/bin/perl

load_rc_config ${name}

if [ -n "${swatch_rules}" ]; then
    for i in ${swatch_rules}; do
	eval swatch_flags=\$swatch_${i}_flags
	eval swatch_user=\$swatch_${i}_user
	eval swatch_chdir=\$swatch_${i}_chdir
	eval pidfile=\$swatch_${i}_pidfile
	run_rc_command "$1"
    done
fi