#!/usr/bin/php -q $e->getMessage()), JSON_PRETTY_PRINT); } restore_error_handler(); $json = json_decode($response, true); if (!$json) { $response = json_encode(array('error' => 'Invalid response from '.$urlbase), JSON_PRETTY_PRINT); $json = json_decode($response, true); } // add params that were sent to $urlbase $json['params'] = $params; // store locally for UPC to access $file = '/tmp/unraidcheck/result.json'; if (!is_dir(dirname($file))) mkdir(dirname($file)); file_put_contents($file, json_encode($json, JSON_PRETTY_PRINT)); // send notification if a newer version is available if ($json && array_key_exists('isNewer',$json) && $json['isNewer']) { $newver = (array_key_exists('version',$json) && $json['version']) ? $json['version'] : 'unknown'; exec("$script -e ".escapeshellarg("System - Unraid [$newver]")." -s ".escapeshellarg("Notice [$server] - Version update $newver")." -d ".escapeshellarg("A new version of Unraid is available")." -i ".escapeshellarg("normal $output")." -l '/Tools/Update' -x"); } exit(0); ?>