diff options
Diffstat (limited to 'config/apcupsd')
-rw-r--r-- | config/apcupsd/apcupsd.conf.php | 2 | ||||
-rw-r--r-- | config/apcupsd/apcupsd.inc | 8 | ||||
-rw-r--r-- | 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 to lockfile> # Path for device lock file. Not used on Win32. -LOCKFILE /var/spool/lock +LOCKFILE {$lockfile} # SCRIPTDIR <path to script directory> # 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 @@ -198,6 +198,13 @@ UPSTYPE DEVICE Description <br> <type>checkbox</type> </field> <field> + <fielddescr>Lock File</fielddescr> + <fieldname>lockfile</fieldname> + <description>Path for device lock file. Default is /var/tmp</description> + <type>input</type> + <size>60</size> + </field> + <field> <name>Configuration parameters used during power failures</name> <type>listtopic</type> </field> |