aboutsummaryrefslogtreecommitdiffstats
path: root/config/apcupsd/apcupsd.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2014-04-28 08:05:18 +0000
committerErmal <eri@pfsense.org>2014-04-28 08:05:18 +0000
commite116c7c7697858fa319f4fae1e8fa4e0912e80f1 (patch)
tree73d03721b48ee52dfb91f687ec5c33312516b591 /config/apcupsd/apcupsd.inc
parent7003a36d5d444b7454ea72fc8d61bc98cddee541 (diff)
parenta3d74723c2bc677f2b6c2f715f8b4cd9a213e791 (diff)
downloadpfsense-packages-e116c7c7697858fa319f4fae1e8fa4e0912e80f1.tar.gz
pfsense-packages-e116c7c7697858fa319f4fae1e8fa4e0912e80f1.tar.bz2
pfsense-packages-e116c7c7697858fa319f4fae1e8fa4e0912e80f1.zip
Merge pull request #647 from dbaio/master
Diffstat (limited to 'config/apcupsd/apcupsd.inc')
-rw-r--r--config/apcupsd/apcupsd.inc7
1 files changed, 7 insertions, 0 deletions
diff --git a/config/apcupsd/apcupsd.inc b/config/apcupsd/apcupsd.inc
index a2b8d2ff..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,6 +164,12 @@ 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 [ ! -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";
}else{