diff options
Diffstat (limited to 'comms/qpage/files/qpage.in')
-rw-r--r-- | comms/qpage/files/qpage.in | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/comms/qpage/files/qpage.in b/comms/qpage/files/qpage.in new file mode 100644 index 000000000000..9d9800d70fa3 --- /dev/null +++ b/comms/qpage/files/qpage.in @@ -0,0 +1,56 @@ +#!/bin/sh + +# PROVIDE: qpage +# REQUIRE: NETWORKING +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable/configure this service: +# +# qpage_enable (bool): Set to NO by default. +# Set it to YES to enable qpage. +# qpage_queue_interval (int): Set to 10 (seconds) by default. +# qpage_cfg_file (path): Set it to an alternate configuration file path +# if desired. +# qpage_flags (str): Set it to a list of additional command-line +# parameters if desired. +# + +. %%RC_SUBR%% + +name="qpage" +rcvar=${name}_enable + +command=%%PREFIX%%/bin/${name} + +load_rc_config $name + +: ${qpage_enable="NO"} +: ${qpage_queue_interval="10"} +: ${qpage_cfg_file=""} +: ${qpage_flags=""} + +stop_cmd=${name}_stop +extra_commands="reload" +reload_cmd=${name}_reload + +command_args="-q ${qpage_queue_interval} ${qpage_flags}" +if [ -n "${qpage_cfg_file}" ]; then + command_args="${command_args} -C ${qpage_cfg_file}" +fi + +qpage_stop() { + /usr/bin/killall qpage +} + +qpage_reload() { + # awk pattern matches master daemon process only (PPID 1 in 3rd column) + pid=`/bin/ps alcxww | /usr/bin/awk "/^ *[0-9]+ +[0-9]+ +1 .* ${name}\$/{print \\\$2}"` + + if [ -n "$pid" ]; then + kill -HUP $pid + else + echo "$0: no qpage daemon found" >& 2 + fi +} + +run_rc_command "$1" |