Updated exit code

This commit is contained in:
Jeroen De Meerleer 2018-09-05 15:04:24 +02:00
parent 67ab931f57
commit 8dbba4e9d0
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6

View File

@ -40,15 +40,13 @@ if (file_exists("cache/get-services.trigger")) {
$rebootjobs = unserialize(file_get_contents("cache/get-services.trigger"));
foreach($rebootjobs as $job) {
if($job['expected'] != 0) {
$services = array();
$url = "ssh " . $job['host'] . " '" . "sudo systemctl list-units | cat" . "' 2>&1";
exec($url, $services);
$services = implode("\n", $services);
$services = array();
$url = "ssh " . $job['host'] . " '" . "sudo systemctl list-units | cat" . "' 2>&1";
exec($url, $services);
$services = implode("\n", $services);
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
$stmt->execute(array($job['jobID'], '200', $services, time()));
}
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
$stmt->execute(array($job['jobID'], '1', $services, time()));
}
unlink("cache/get-services.trigger");
unlink("cache/reboot-time.trigger");