diff options
Diffstat (limited to 'security/courier-authlib/files/courier-authdaemond.sh.in')
-rw-r--r-- | security/courier-authlib/files/courier-authdaemond.sh.in | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/security/courier-authlib/files/courier-authdaemond.sh.in b/security/courier-authlib/files/courier-authdaemond.sh.in new file mode 100644 index 000000000000..b50f491d60e6 --- /dev/null +++ b/security/courier-authlib/files/courier-authdaemond.sh.in @@ -0,0 +1,62 @@ +#!/bin/sh +# +# An rc.subr-style startup script for courier-authdaemond service. + +# PROVIDE: courier_authdaemond +# REQUIRE: DAEMON +# BEFORE: mail imap +# KEYWORD: FreeBSD shutdown + +prefix="%%PREFIX%%" +exec_prefix="${prefix}" +sysconfdir="${prefix}/etc/authlib" +sbindir="${exec_prefix}/sbin" +bindir="${exec_prefix}/bin" +libdir="${prefix}/lib/courier-authlib" +libexecdir="${prefix}/libexec/courier-authlib" +authdaemonvar="%%AUTHDAEMONVAR%%" + +# Define these courier_authdaemond_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/courier_authdaemond +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE + +courier_authdaemond_enable=${courier_authdaemond_enable-"NO"} # Run courier-authdaemond (YES/NO). + +. %%RC_SUBR%% + +name="courier_authdaemond" +rcvar=`set_rcvar` + +command="${sbindir}/authdaemond" +procname="${sbindir}/courierlogger" +pidfile="${authdaemonvar}/pid" +socket="${authdaemonvar}/socket" + +start_precmd="${name}_prestart" +start_cmd="${command} start" +stop_precmd="echo 'Stopping ${name}.'" +stop_cmd="${command} stop" +stop_postcmd="rm -f ${pidfile} ${pidfile}.lock ${socket}" +restart_cmd="${start_cmd} && ${stop_cmd}" +required_files="${sysconfdir}/authdaemonrc" + +courier_authdaemond_prestart() +{ + if [ ! -d "${authdaemonvar}" ] ; then + install -o %%MAILOWN%% -g %%MAILGRP%% -m 0750 -d "${authdaemonvar}" + if [ $? -ne 0 ] ; then + echo "Creating ${authdaemonvar} with the correct permissions was not possible!" + return 1 + fi + fi + /sbin/ldconfig -m "${libdir}" + echo "Starting ${name}." +} + +load_rc_config $name +run_rc_command "$1" + + |