diff options
-rw-r--r-- | databases/mysql-proxy/files/mysql-proxy.in | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/databases/mysql-proxy/files/mysql-proxy.in b/databases/mysql-proxy/files/mysql-proxy.in index 0a2f45be3dbf..03cdabf9ef8b 100644 --- a/databases/mysql-proxy/files/mysql-proxy.in +++ b/databases/mysql-proxy/files/mysql-proxy.in @@ -1,12 +1,10 @@ #!/bin/sh -# + # $FreeBSD$ # - # PROVIDE: mysql-proxy # REQUIRE: LOGIN # KEYWORD: shutdown - # # Add the following line to /etc/rc.conf to enable mysql-proxy: # mysql_proxy_enable (bool): Set to "NO" by default. @@ -35,15 +33,21 @@ load_rc_config $name : ${mysql_proxy_enable="NO"} : ${mysql_proxy_address=":4040"} : ${mysql_proxy_backend_addresses="127.0.0.1:3306"} -: ${mysql_proxy_pid_file="/var/run/mysql-proxy.pid"} -for addr in ${mysql_proxy_backend_addresses}; do - proxy_backend_addresses="${proxy_backend_addresses} --proxy-backend-addresses=${addr}" -done +start_precmd="${name}_prestart" + +mysql_proxy_prestart() +{ + local addr + + for addr in ${mysql_proxy_backend_addresses}; do + command_args="${command_args} --proxy-backend-addresses=${addr}" + done +} -pidfile="${mysql_proxy_pid_file}" +pidfile="${mysql_proxy_pid_file:-"/var/run/mysql-proxy.pid"}" command=%%PREFIX%%/libexec/mysql-proxy -command_args="--proxy-address=${mysql_proxy_address} ${proxy_backend_addresses} ${mysql_proxy_args} --daemon --pid-file=${mysql_proxy_pid_file}" +command_args="--proxy-address=${mysql_proxy_address} ${mysql_proxy_args} --daemon --pid-file=${pidfile}" procname=%%PREFIX%%/libexec/mysql-proxy run_rc_command "$1" |