blob: e216c9f4af5408493c1e6716384f89722d96c1f3 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/sh
#
# PROVIDE: simplomon
# REQUIRE: NETWORKING SERVERS
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# simplomon_enable (bool): Set to NO by default.
# Set it to YES to enable simplomon.
# simplomon_acct (user): Set user to run simplomon as.
# Default is "www".
# simplomon_config (path): Set to /usr/local/etc/simplomon.conf
# by default.
#
. /etc/rc.subr
name=simplomon
rcvar=simplomon_enable
load_rc_config $name
: ${simplomon_enable:="NO"}
: ${simplomon_acct:="www"}
: ${simplomon_config:="%%PREFIX%%/etc/simplomon.conf"}
pidfile="/var/run/${name}.pid"
daemon_pidfile="/var/run/${name}-daemon.pid"
required_files="${simplomon_config}"
procname="%%PREFIX%%/bin/simplomon"
command="/usr/sbin/daemon"
command_args="-c -r -R 15 -f -t ${name} -T ${name} \
-p ${pidfile} \
-P ${daemon_pidfile} \
-u ${simplomon_acct} \
${procname} ${simplomon_config}"
start_precmd=simplomon_precmd
simplomon_precmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${simplomon_acct} -g wheel -m 644 /dev/null ${pidfile}
fi
if [ ! -e ${daemon_pidfile} ]; then
install -o ${simplomon_acct} -g wheel -m 644 /dev/null ${daemon_pidfile}
fi
}
run_rc_command "$1"
|