From afb2683350af9c66cf6708955f2af3016633c41b Mon Sep 17 00:00:00 2001 From: "Danilo G. Baio (dbaio)" Date: Mon, 14 Apr 2014 15:26:52 -0300 Subject: apcupsd - fix lock file when using usb devices --- config/apcupsd/apcupsd.inc | 3 +++ config/apcupsd/apcupsd.xml | 2 +- pkg_config.10.xml | 2 +- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config/apcupsd/apcupsd.inc b/config/apcupsd/apcupsd.inc index a2b8d2ff..95abeca8 100644 --- a/config/apcupsd/apcupsd.inc +++ b/config/apcupsd/apcupsd.inc @@ -163,6 +163,9 @@ function sync_package_apcupsd(){ $apcupsd_rcfile="/usr/local/etc/rc.d/apcupsd.sh"; if (is_array($apcupsd_config) && $apcupsd_config['apcupsdenabled']=="on"){ $apcupsd_start = "echo \"Starting APC UPS Daemon...\"\n"; + $apcupsd_start .= " if [ -f /var/spool/lock/LCK.. ]; then \n"; + $apcupsd_start .= " /bin/rm -f /var/spool/lock/LCK.. \n"; + $apcupsd_start .= " fi \n"; if ($apcupsd_config['killonpowerfail']=="on"){ $apcupsd_start .= " " . APCUPSD_BASE . "/sbin/apcupsd --kill-on-powerfail"; }else{ diff --git a/config/apcupsd/apcupsd.xml b/config/apcupsd/apcupsd.xml index e69344fc..f9003a61 100644 --- a/config/apcupsd/apcupsd.xml +++ b/config/apcupsd/apcupsd.xml @@ -40,7 +40,7 @@ Apcupsd Services: Apcupsd (General) Monitoring - 0.2 + 0.3 /usr/local/pkg/apcupsd.inc Apcupsd has been created/modified. Apcupsd has been deleted. diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 869c2fe4..159223e1 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -1534,7 +1534,7 @@ Set of programs for controlling APC UPS. Services https://packages.pfsense.org/packages/config/apcupsd/apcupsd.xml - apcupsd-3.14.10_1 pkg v0.2 + apcupsd-3.14.10_1 pkg v0.3 BETA 2.2 apcupsd.xml diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 6105f136..21d86ea5 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1981,7 +1981,7 @@ Set of programs for controlling APC UPS. Services https://packages.pfsense.org/packages/config/apcupsd/apcupsd.xml - apcupsd-3.14.10_1 pkg v0.2 + apcupsd-3.14.10_1 pkg v0.3 BETA 2.0 apcupsd.xml diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 404d0967..8199d94c 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1968,7 +1968,7 @@ Set of programs for controlling APC UPS. Services https://packages.pfsense.org/packages/config/apcupsd/apcupsd.xml - apcupsd-3.14.10_1 pkg v0.2 + apcupsd-3.14.10_1 pkg v0.3 BETA 2.0 apcupsd.xml -- cgit v1.2.3 From a3d74723c2bc677f2b6c2f715f8b4cd9a213e791 Mon Sep 17 00:00:00 2001 From: "Danilo G. Baio (dbaio)" Date: Mon, 21 Apr 2014 15:32:21 -0300 Subject: apcupsd - add lockfile option --- config/apcupsd/apcupsd.conf.php | 2 +- config/apcupsd/apcupsd.inc | 8 ++++++-- config/apcupsd/apcupsd.xml | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/config/apcupsd/apcupsd.conf.php b/config/apcupsd/apcupsd.conf.php index 7a0340cd..7b6096bc 100644 --- a/config/apcupsd/apcupsd.conf.php +++ b/config/apcupsd/apcupsd.conf.php @@ -122,7 +122,7 @@ POLLTIME {$polltime} # LOCKFILE # Path for device lock file. Not used on Win32. -LOCKFILE /var/spool/lock +LOCKFILE {$lockfile} # SCRIPTDIR # Directory in which apccontrol and event scripts are located. diff --git a/config/apcupsd/apcupsd.inc b/config/apcupsd/apcupsd.inc index 95abeca8..3340738a 100644 --- a/config/apcupsd/apcupsd.inc +++ b/config/apcupsd/apcupsd.inc @@ -153,6 +153,7 @@ function sync_package_apcupsd(){ $nisport=($apcupsd_config['nisport'] != ''? $apcupsd_config['nisport'] : "3551"); $upsclass=$apcupsd_config['upsclass']; $upsmode=$apcupsd_config['upsmode']; + $lockfile=($apcupsd_config['lockfile'] != ''? $apcupsd_config['lockfile'] : "/var/tmp"); include("/usr/local/pkg/apcupsd.conf.php"); file_put_contents(APCUPSD_BASE . "/etc/apcupsd/apcupsd.conf", $apcupsdconf, LOCK_EX); @@ -163,8 +164,11 @@ function sync_package_apcupsd(){ $apcupsd_rcfile="/usr/local/etc/rc.d/apcupsd.sh"; if (is_array($apcupsd_config) && $apcupsd_config['apcupsdenabled']=="on"){ $apcupsd_start = "echo \"Starting APC UPS Daemon...\"\n"; - $apcupsd_start .= " if [ -f /var/spool/lock/LCK.. ]; then \n"; - $apcupsd_start .= " /bin/rm -f /var/spool/lock/LCK.. \n"; + $apcupsd_start .= " if [ ! -d {$lockfile} ]; then \n"; + $apcupsd_start .= " /bin/mkdir -p {$lockfile} \n"; + $apcupsd_start .= " fi \n"; + $apcupsd_start .= " if [ -f {$lockfile}/LCK.. ]; then \n"; + $apcupsd_start .= " /bin/rm -f {$lockfile}/LCK.. \n"; $apcupsd_start .= " fi \n"; if ($apcupsd_config['killonpowerfail']=="on"){ $apcupsd_start .= " " . APCUPSD_BASE . "/sbin/apcupsd --kill-on-powerfail"; diff --git a/config/apcupsd/apcupsd.xml b/config/apcupsd/apcupsd.xml index f9003a61..3ed95a7a 100644 --- a/config/apcupsd/apcupsd.xml +++ b/config/apcupsd/apcupsd.xml @@ -197,6 +197,13 @@ UPSTYPE DEVICE Description
Hibernate UPS on powerfail checkbox + + Lock File + lockfile + Path for device lock file. Default is /var/tmp + input + 60 + Configuration parameters used during power failures listtopic -- cgit v1.2.3