Added separate unRAID OS check schedule and associated notifications

This commit is contained in:
bergware
2017-06-19 15:39:20 +02:00
parent efa678e9a1
commit e2a99febf2
4 changed files with 97 additions and 24 deletions
@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2012-2016, Bergware International.
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -12,7 +12,7 @@
*/
?>
<?
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
@@ -22,19 +22,18 @@ $unraid = parse_plugin_cfg('dynamix', true);
$notify = "$docroot/webGui/scripts/notify";
$server = strtoupper($var['NAME']);
$output = $unraid['notify']['plugin'];
$builtin = ['unRAIDServer','dynamix'];
plugin("checkall");
plugin('checkall');
foreach (glob("/tmp/plugins/*.plg", GLOB_NOSORT) as $file) {
$plg = basename($file);
$name = basename($plg, '.plg');
if (in_array($name,$builtin)) continue;
$old = plugin('version', "/var/log/plugins/$plg");
$new = plugin('version', $file);
// silently suppress bad download of PLG file
if (strcmp($new, $old) > 0) {
$unRAID = plugin('unRAID', $file);
if ($unRAID === false || version_compare($current['version'], $unRAID, '>=')) {
$name = basename($file, '.plg');
exec("$notify -e ".escapeshellarg("Plugin - $name [$new]")." -s ".escapeshellarg("Notice [$server] - Version update $new")." -d ".escapeshellarg("A new version of $name is available")." -i ".escapeshellarg("normal $output")." -x");
}
exec("$notify -e ".escapeshellarg("Plugin - $name [$new]")." -s ".escapeshellarg("Notice [$server] - Version update $new")." -d ".escapeshellarg("A new version of $name is available")." -i ".escapeshellarg("normal $output")." -x");
}
}
exit(0);