From 3cc82d5b4b377837ecdc83e05a116c5cda8f20cc Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 19 Dec 2017 09:19:28 +0000 Subject: [PATCH] sysutils/nut: further tweaks --- README.md | 4 +++- sysutils/nut/pkg-descr | 2 +- .../OPNsense/Nut/Api/ServiceController.php | 12 ++++++++---- .../app/controllers/OPNsense/Nut/forms/settings.xml | 2 +- .../nut/src/opnsense/scripts/OPNsense/Nut/setup.sh | 0 .../src/opnsense/service/templates/OPNsense/Nut/nut | 3 ++- 6 files changed, 15 insertions(+), 8 deletions(-) mode change 100644 => 100755 sysutils/nut/src/opnsense/scripts/OPNsense/Nut/setup.sh diff --git a/README.md b/README.md index ce67f4ca5..16ad199a7 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,10 @@ net-mgmt/collectd -- Collect system and application performance metrics periodic net-mgmt/snmp -- SNMP Server via bsnmpd net-mgmt/telegraf -- Agent for collecting metrics and data net-mgmt/zabbix-agent -- Enterprise-class open source distributed monitoring agent -net-mgmt/zabbix-proxy -- Zabbix-Proxy enables decentralized monitoring +net-mgmt/zabbix-proxy -- Zabbix Proxy enables decentralized monitoring net/arp-scan -- Get all peers connected to a local network net/freeradius -- RADIUS Authentication, Authorization and Accounting Server +net/frr -- FRR Routing Suite net/ftp-proxy -- Control ftp-proxy processes net/haproxy -- Reliable, high performance TCP/HTTP load balancer net/igmp-proxy -- IGMP-Proxy Service @@ -66,6 +67,7 @@ security/tinc -- Tinc VPN security/tor -- The Onion Router sysutils/boot-delay -- Apply a persistent 10 second boot delay sysutils/monit -- Proactive system monitoring +sysutils/nut -- Network UPS Tools sysutils/smart -- SMART tools sysutils/vmware -- VMware tools sysutils/xen -- Xen guest utilities diff --git a/sysutils/nut/pkg-descr b/sysutils/nut/pkg-descr index f3f602f94..81bf4f70d 100644 --- a/sysutils/nut/pkg-descr +++ b/sysutils/nut/pkg-descr @@ -4,4 +4,4 @@ Power Distribution Units, Automatic Transfer Switch, Power Supply Units and Solar Controllers. NUT provides many control and monitoring features, with a uniform control -and management interface. \ No newline at end of file +and management interface. diff --git a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php index 3cd963560..48befe674 100644 --- a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php +++ b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php @@ -1,7 +1,7 @@ request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun('nut restart'); return array('response' => $response); @@ -76,7 +77,6 @@ class ServiceController extends ApiControllerBase $status = 'unknown'; } - return array('status' => $status); } @@ -115,6 +115,8 @@ class ServiceController extends ApiControllerBase public function stopAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun('nut stop'); return array('response' => $response); @@ -129,6 +131,8 @@ class ServiceController extends ApiControllerBase public function startAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun('nut start'); return array('response' => $response); diff --git a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml index dbdfa325c..d2c659f35 100644 --- a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml +++ b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml @@ -3,7 +3,7 @@ nut.general.enable - + checkbox Enable or disable the nut service. diff --git a/sysutils/nut/src/opnsense/scripts/OPNsense/Nut/setup.sh b/sysutils/nut/src/opnsense/scripts/OPNsense/Nut/setup.sh old mode 100644 new mode 100755 diff --git a/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/nut b/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/nut index 60d9c1562..f41bd9b00 100644 --- a/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/nut +++ b/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/nut @@ -1,6 +1,7 @@ {% if helpers.exists('OPNsense.Nut.general.enable') and OPNsense.Nut.general.enable == '1' %} -nut_enable="YES" nut_opnsense_bootup_run="/usr/local/opnsense/scripts/OPNsense/Nut/setup.sh" +nut_var_script="/usr/local/opnsense/scripts/OPNsense/Nut/setup.sh" +nut_enable="YES" {% else %} nut_enable="NO" {% endif %}