#!/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@FreeBSD.org) . /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"