blob: e8fc248d86e4b21c8fc3620552c5733acb4211fe (
plain)
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
|
#!/bin/sh
# PROVIDE: librenms
# REQUIRE: SERVERS mysql
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# librenms_enable: Set to NO by default.
# Set it to YES to enable librenms
# librenms_user: The user account used to run the daemon.
# Default: %%USER%%
# librenms_group: The group account used to run the daemon.
# Default: %%GROUP%%
# librenms_pid: Path of the pid file.
# Default /var/run/librenms/librenms.pid
# librenms_daemonflags: Flags passed to daemon(8), overwrite this to use eg syslog
# Default "-o /var/log/librenms/librenms-service.log"
#
# Contributed by: Dries Michiels (driesm.michiels@gmail.com)
. /etc/rc.subr
name=librenms
rcvar="${name}_enable"
load_rc_config $name
: ${librenms_enable:="NO"}
: ${librenms_user:="%%USER%%"}
: ${librenms_group:="%%GROUP%%"}
: ${librenms_pid:="/var/run/librenms/librenms.pid"}
: ${librenms_daemonflags:="-o /var/log/$name/$name-service.log"}
pidfile="$librenms_pid"
procname="%%PYTHON%%"
command="/usr/sbin/daemon"
start_precmd=librenms_precmd
librenms_precmd()
{
[ -f /var/log/$name/$name-service.log ] || install -g $librenms_group -o $librenms_user -m 644 /dev/null /var/log/$name/$name-service.log
[ -f /var/log/$name/$name.log ] || install -g $librenms_group -o $librenms_user -m 644 /dev/null /var/log/$name/$name.log
}
command_args="$librenms_daemonflags -p $pidfile $procname %%WWWDIR%%/librenms-service.py"
run_rc_command "$1"
|