summaryrefslogtreecommitdiff
path: root/www/commission/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/commission/index.php')
-rw-r--r--www/commission/index.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/www/commission/index.php b/www/commission/index.php
index 5721968..23f86cf 100644
--- a/www/commission/index.php
+++ b/www/commission/index.php
@@ -137,10 +137,31 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
$result2 = trim(fread($handle, 4192));
$status2 = pclose($handle);
syslog(LOG_ALERT, "passwd: status: $status result: $result");
- if ($status === 0) {
+ if ($status == 0) {
$finished = "Commissioning Complete";
$password_err = $result2;
$username_err = $result;
+ // Disable commissioning
+ $cmd = "ln -sf /var/config/default/commissioning /etc/default/commissioning 2>&1;echo 'ENABLED=\"no\"' >/var/config/default/commissioning 2>&1";
+ $handle = popen($cmd, 'r');
+ $result = trim(fread($handle, 4192));
+ $status = pclose($handle);
+ if ($status > 0) {
+ syslog(LOG_ALERT, "configure commissioning off failure: command: $cmd");
+ syslog(LOG_ALERT, "passwd: status: $status result: $result");
+ } else {
+ // shut off web server
+ $cmd = "/usr/sbin/start-stop-daemon -S -p /var/run/commissionoff.pid -b -a /bin/bash -- -c " .
+ "/usr/share/commissioning/off/off.sh";
+ syslog(LOG_ALERT, "turn off web server: command: $cmd");
+ $handle = popen($cmd, 'r');
+ $result = trim(fread($handle, 4192));
+ $status = pclose($handle);
+ if ($status > 0) {
+ syslog(LOG_ALERT, "turn off commissioning service: command: $cmd");
+ syslog(LOG_ALERT, "stopping service: status: $status result: $result");
+ }
+ }
} else {
$finished = "Errors: " . $result;
$save_password = "";