#!/bin/sh # PROVIDE: maiad # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable maiad: # maiad_enable (bool): Set it to "YES" to enable maiad. # Default is "NO". # . /etc/rc.subr name=maiad rcvar=maiad_enable load_rc_config $name : ${maiad_enable:=NO} : ${maiad_pidfile="/var/run/maia/maiad.pid"} required_files=%%ETCDIR%%/maiad.conf start_cmd="%%PREFIX%%/sbin/maiad start" start_precmd="start_precmd" extra_commands="status" pidfile=${maiad_pidfile} procname=maiad start_precmd() { for i in db tmp var virusmails; do if [ ! -e %%MAIAHOME%%/${i} ]; then install -d -o %%USERS%% -g %%GROUPS%% -m 750 %%MAIAHOME%%/${i} fi done for i in log run lock; do if [ ! -e /var/${i}/maia ]; then install -d -o %%USERS%% -g %%GROUPS%% /var/${i}/maia fi done # not sure why, but previous maintainer had this in the rc script rm -rf %%MAIAHOME%%/tmp/* %%MAIAHOME%%/tmp/.* 2>/dev/null || true } run_rc_command "$1"