diff options
author | mm <mm@FreeBSD.org> | 2010-08-31 18:11:59 +0800 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2010-08-31 18:11:59 +0800 |
commit | 44b09da737018bd6c2c54429875b586046bcfa66 (patch) | |
tree | fbd961c34ac6da540888d8d6acc5a59547c029bc /www | |
parent | 9241d00b978ad443a54d83c190749577a1b12a7f (diff) | |
download | freebsd-ports-gnome-44b09da737018bd6c2c54429875b586046bcfa66.tar.gz freebsd-ports-gnome-44b09da737018bd6c2c54429875b586046bcfa66.tar.zst freebsd-ports-gnome-44b09da737018bd6c2c54429875b586046bcfa66.zip |
- Add multiple instances ability to rc script
Diffstat (limited to 'www')
-rw-r--r-- | www/lighttpd/Makefile | 2 | ||||
-rw-r--r-- | www/lighttpd/files/lighttpd.sh.in | 62 |
2 files changed, 57 insertions, 7 deletions
diff --git a/www/lighttpd/Makefile b/www/lighttpd/Makefile index e1453f9a452c..6999872abe80 100644 --- a/www/lighttpd/Makefile +++ b/www/lighttpd/Makefile @@ -7,7 +7,7 @@ PORTNAME?= lighttpd PORTVERSION= 1.4.28 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES?= www MASTER_SITES?= http://download.lighttpd.net/lighttpd/releases-1.4.x/ diff --git a/www/lighttpd/files/lighttpd.sh.in b/www/lighttpd/files/lighttpd.sh.in index f87920716dee..6f12a3ef2a35 100644 --- a/www/lighttpd/files/lighttpd.sh.in +++ b/www/lighttpd/files/lighttpd.sh.in @@ -10,11 +10,21 @@ # # lighttpd_enable (bool): Set it to "YES" to enable lighttpd # Default is "NO". -# lighttpd_conf (path): Set full path to config file. +# lighttpd_conf (path): Set full path to configuration file. # Default is "%%PREFIX%%/etc/lighttpd/lighttpd.conf". # lighttpd_pidfile (path): Set full path to pid file. # Default is "/var/run/lighttpd.pid". # +# Add the following lines to /etc/rc.conf for multiple instances: +# (overrides lighttpd_conf and lighttpd_pidfile from above) +# +# lighttpd_instances (string): Instances of lighttpd +# Default is "" (no instances). +# lighttpd_${i}_conf (path): Set full path to instance configuration file. +# Default is "%%PREFIX%%/etc/lighttpd/${i}.conf". +# lighttpd_${i}_pidfile (path): Set full path to instance pid file +# Default is "/var/run/lighttpd_${i}.pid". +# . /etc/rc.subr @@ -26,6 +36,7 @@ load_rc_config $name : ${lighttpd_enable="NO"} : ${lighttpd_conf=""} : ${lighttpd_pidfile="/var/run/${name}.pid"} +: ${lighttpd_instances=""} # Compatibility for old configuration file location deprecated_conf= @@ -39,10 +50,6 @@ if [ -z "${lighttpd_conf}" ]; then fi command=%%PREFIX%%/sbin/lighttpd -command_args="-f ${lighttpd_conf}" -pidfile=${lighttpd_pidfile} -required_files=${lighttpd_conf} -start_precmd="check_deprecated" stop_postcmd=stop_postcmd restart_precmd="checkconfig" reload_precmd=reload_precmd @@ -50,6 +57,9 @@ reload_postcmd=reload_postcmd sig_reload="INT" check_cmd="checkconfig" extra_commands="reload check" +command_args="-f ${lighttpd_conf}" +pidfile=${lighttpd_pidfile} +required_files=${lighttpd_conf} check_deprecated() { @@ -88,4 +98,44 @@ reload_postcmd() run_rc_command start } -run_rc_command "$1" +run_instance() +{ + _i="$1" + _rcmd="$2" + name=${_orig_name}_${_i} + eval ${name}_enable=${lighttpd_enable} + eval lighttpd_conf=\"\${lighttpd_${_i}_conf:-"%%PREFIX%%/etc/lighttpd/${_i}.conf"}\" + eval lighttpd_pidfile=\"\${lighttpd_${_i}_pidfile:-"/var/run/lighttpd_${_i}.pid"}\" + command_args="-f ${lighttpd_conf}" + pidfile=${lighttpd_pidfile} + required_files=${lighttpd_conf} + run_rc_command ${_rcmd} +} + +if [ -n "${lighttpd_instances}" ]; then + _orig_name="${name}" + _run_cmd="$1" + if [ $# -gt 0 ]; then + shift + fi + if [ -n "$*" ]; then + _run_instances="$*" + fi + if [ -n "${_run_instances}" ]; then + for _a in $_run_instances; do + for _in in ${lighttpd_instances}; do + if [ "$_a" = "$_in" ]; then + _runlist="${_runlist} ${_a}" + fi + done + done + else + _runlist="${lighttpd_instances}" + fi + for _in in ${_runlist}; do + run_instance $_in $_run_cmd + done +else + start_precmd="check_deprecated" + run_rc_command "$1" +fi |