aboutsummaryrefslogtreecommitdiffstats
path: root/config/nut/nut.inc
diff options
context:
space:
mode:
Diffstat (limited to 'config/nut/nut.inc')
-rw-r--r--config/nut/nut.inc11
1 files changed, 2 insertions, 9 deletions
diff --git a/config/nut/nut.inc b/config/nut/nut.inc
index 578bb82f..6467ec13 100644
--- a/config/nut/nut.inc
+++ b/config/nut/nut.inc
@@ -498,8 +498,6 @@ EOD;
global $config;
global $input_errors;
- config_lock();
-
stop_service("nut");
/* create state path */
@@ -514,15 +512,12 @@ EOD;
$return = sync_package_nut_snmp();
}
- if ($return && $_POST['monitor']) {
- /* only start if changing settings as we have a startup script for system boot */
+ if ((!platform_booting()) && (nut_config('monitor'))) {
+ /* only start if enabled and system is not booting */
/* this prevents service from starting / stopping / starting on boot */
log_error("[nut] INFO: Starting service");
start_service("nut");
- if ((int)exec('/bin/pgrep upsmon | /usr/bin/wc -l') == 0) {
- log_error("[nut] ERROR: Service failed to start: check configuration.");
- }
} elseif (!$return && file_exists(NUT_RCFILE)) {
/* no parameters user does not want nut running */
/* lets stop the service and remove the rc file */
@@ -542,7 +537,5 @@ EOD;
exec('/bin/rm -rf /var/db/nut');
conf_mount_ro();
}
-
- config_unlock();
}
?>