diff options
author | pav <pav@FreeBSD.org> | 2006-10-08 05:30:59 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2006-10-08 05:30:59 +0800 |
commit | 0456d30606dc9c91424ce0a82e1113ce505e3c2e (patch) | |
tree | 17ad72aee56e57653a7f08ff13964e46c3466d34 /sysutils | |
parent | 59525a08ac273f122be46ce047f303da44eb78ef (diff) | |
download | freebsd-ports-gnome-0456d30606dc9c91424ce0a82e1113ce505e3c2e.tar.gz freebsd-ports-gnome-0456d30606dc9c91424ce0a82e1113ce505e3c2e.tar.zst freebsd-ports-gnome-0456d30606dc9c91424ce0a82e1113ce505e3c2e.zip |
- Provide rc script
PR: ports/95708
Submitted by: Jo Rhett <jrhett@svcolo.com>
Approved by: Nicolas Jombart <ecu@ipv42.net> (maintainer)
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/sec/Makefile | 4 | ||||
-rw-r--r-- | sysutils/sec/files/sec.in | 77 |
2 files changed, 81 insertions, 0 deletions
diff --git a/sysutils/sec/Makefile b/sysutils/sec/Makefile index 587fcacda71d..66dfb8eb44b3 100644 --- a/sysutils/sec/Makefile +++ b/sysutils/sec/Makefile @@ -7,6 +7,7 @@ PORTNAME= sec PORTVERSION= 2.3.3 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= simple-evcorr @@ -17,6 +18,9 @@ COMMENT= Simple event (logs) correlator USE_PERL5_RUN= YES NO_BUILD= YES +USE_RC_SUBR= sec +SUB_LIST= PERL=${PERL} + MAN8= sec.8 PORTDOCS= ChangeLog README convert.pl itostream.c PLIST_FILES= bin/sec diff --git a/sysutils/sec/files/sec.in b/sysutils/sec/files/sec.in new file mode 100644 index 000000000000..b8e0f84090a2 --- /dev/null +++ b/sysutils/sec/files/sec.in @@ -0,0 +1,77 @@ +#!/bin/sh +# +# Add the following lines to /etc/rc.conf to enable sec: +# sec_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable sec. +# +# These flags control the first (or only) instance of sec. +# sec_flags (str): Set to "" by default. +# sec_configfile (str): Set to "%%PREFIX%%/etc/sec.conf" by default. +# +# To handle multiple instances you can also define +# sec_instances="main auth" (list): define the instances (any string) which should be started/stopped +# sec_instance_main_flags (str): define the invocation options for the first instance +# sec_instance_main_configfile (str): define the config file for the first instance +# sec_instance_auth_flags (str): define the invocation options for the second instance +# sec_instance_auth_configfile (str): define the config file for the second instance +# ...etc +# + +. %%RC_SUBR%% + +name="sec" +rcvar=`set_rcvar` + +command="%%PREFIX%%/bin/sec" +command_args="-detach" +command_interpreter="%%PERL%%" +extra_commands="reload" +pidfile="/var/run/sec.pid" + +start_precmd="sec_checkconfig" +reload_precmd="sec_checkconfig" +restart_precmd="sec_checkconfig" +sig_reload=HUP + +load_rc_config "${name}" +[ -z "${sec_enable}" ] && sec_enable="NO" +[ -z "${sec_flags}" ] && sec_flags="-log=/var/log/sec.log" +[ -z "${sec_configfile}" ] && sec_configfile="%%PREFIX%%/etc/sec.conf" +[ -z "${sec_instances}" ] && sec_instances="" + +sec_checkconfig() { + if [ -z $instance ] + then + echo -n "Performing sanity check of sec configuration: " + else + echo -n "Performing sanity check of sec_${instance} configuration: " + fi + ${command} -debug=1 -testonly -conf=${sec_configfile} 2>&1 >/dev/null + if [ $? != 0 ]; then + echo "FAILED" + ${command} -testonly -conf=${sec_configfile} + return 1 + else + echo "OK" + fi +} + +required_files="${sec_configfile}" +sec_flags="-conf=${sec_configfile} -pid=${pidfile} ${sec_flags}" + +run_rc_command "$1" + +# Are we handling multiple instance mode? +if [ ! -z "${sec_instances}" ] +then + for instance in $sec_instances + do + # Iterate through all instances + name="sec_${instance}" + pidfile="/var/run/sec_${instance}.pid" + eval required_files=\$sec_${instance}_configfile + eval sec_${instance}_flags="\"-conf=\$sec_${instance}_configfile -pid=\$pidfile \$sec_${instance}_flags\"" + + run_rc_command "$1" + done +fi |