From 00561b63b7171dafe5906abf17cb413e647cdecc Mon Sep 17 00:00:00 2001 From: k-paulius Date: Sun, 22 Mar 2015 16:43:08 -0500 Subject: Prevent radiusd from being started multiple times by adding critical section to the startup script. Fixes #4337. --- config/freeradius2/freeradius.inc | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/config/freeradius2/freeradius.inc b/config/freeradius2/freeradius.inc index df231821..00076816 100644 --- a/config/freeradius2/freeradius.inc +++ b/config/freeradius2/freeradius.inc @@ -134,7 +134,42 @@ function freeradius_install_command() { $rcfile = array(); $rcfile['file'] = 'radiusd.sh'; - $rcfile['start'] = FREERADIUS_ETC . '/rc.d/radiusd onestart'; + $freeradius_etc_dir = FREERADIUS_ETC; + $rcfile['start'] = << "\$LOCKFILE") 2> /dev/null; then + # make sure lock file is removed even if script is terminated + trap 'rm -f "\$LOCKFILE"; exit \$?' INT TERM EXIT + + {$freeradius_etc_dir}/rc.d/radiusd onestart + + # try to wait until the service starts + if [ ! -f "\$PIDFILE" ]; then + echo "\$SERVICENAME.sh: PID file was not found" + + for i in 1 2 3 4 5; do + if [ -f "\$PIDFILE" ]; then + echo "\$SERVICENAME.sh: Service started PID: `cat \$PIDFILE`" + break + else + echo "\$SERVICENAME.sh: Waiting 0.5 seconds" + sleep 0.5 + fi + done + else + echo "\$SERVICENAME.sh: Service running PID: `cat \$PIDFILE`" + fi + + rm -f "\$LOCKFILE" + trap - INT TERM EXIT + else + echo "\$SERVICENAME.sh: Cannot continue at this moment, this script is already trying to start service PID: \$(cat \$LOCKFILE)" + fi +EOD; $rcfile['stop'] = FREERADIUS_ETC . '/rc.d/radiusd onestop'; write_rcfile($rcfile); conf_mount_ro(); -- cgit v1.2.3 From 8a344ecccd0f111562804d4a01828386458c7fb6 Mon Sep 17 00:00:00 2001 From: k-paulius Date: Sun, 22 Mar 2015 19:28:02 -0500 Subject: Bumping freeradius2 package version. --- pkg_config.10.xml | 2 +- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 1dbb004f..e7e9472d 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -788,7 +788,7 @@ On pfSense docs there is a how-to which could help you on porting users.]]> https://doc.pfsense.org/index.php/FreeRADIUS_2.x_package System - 2.1.12_1/2.2.6_3 pkg v1.6.10 + 2.2.6_3 pkg v1.6.11 RC1 2.2 nachtfalkeaw@web.de diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 88da6df0..43dfecab 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1041,7 +1041,7 @@ On pfSense docs there is a how-to which could help you on porting users.]]> https://doc.pfsense.org/index.php/FreeRADIUS_2.x_package System - 2.1.12_1/2.2.5_3 pkg v1.6.10 + 2.2.5_3 pkg v1.6.11 RC1 2.1 nachtfalkeaw@web.de diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 31ae8cde..84366e26 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1028,7 +1028,7 @@ On pfSense docs there is a how-to which could help you on porting users.]]> https://doc.pfsense.org/index.php/FreeRADIUS_2.x_package System - 2.1.12_1/2.2.5_3 pkg v1.6.10 + 2.2.5_3 pkg v1.6.11 RC1 2.1 nachtfalkeaw@web.de -- cgit v1.2.3