diff options
author | John Klug <john.klug@multitech.com> | 2019-12-02 19:02:07 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2019-12-02 19:02:07 -0600 |
commit | c296a35072f3fb630f48aac225e34f35440c1bcb (patch) | |
tree | c68d22ddc5a933488d272eab739cc992292ac1f2 /www | |
parent | f230e0b1d9e027e6f98f218efbb74946b7a94b92 (diff) | |
download | commissioning-c296a35072f3fb630f48aac225e34f35440c1bcb.tar.gz commissioning-c296a35072f3fb630f48aac225e34f35440c1bcb.tar.bz2 commissioning-c296a35072f3fb630f48aac225e34f35440c1bcb.zip |
Allow some time after submit to shut down lighttpd
Diffstat (limited to 'www')
-rw-r--r-- | www/commission/index.php | 23 |
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 = ""; |