<?php
|
|
|
|
namespace App\Commands;
|
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use LaravelZero\Framework\Commands\Command;
|
|
|
|
use Log;
|
|
|
|
class MonitoringStateCommand extends Command
|
|
{
|
|
/**
|
|
* The signature of the command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'monitoring:state';
|
|
|
|
/**
|
|
* The description of the command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'I';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
// getting harddisks
|
|
exec('df -H | grep \'^/dev\'', $harddisks);
|
|
|
|
//
|
|
exec('$(apt list --upgradable 2>/dev/null | grep "\-security" | wc -l)', $securityUpgrades);
|
|
|
|
if (isset($securityUpgrades[0]) && intval($securityUpgrades[0]) > 0) {
|
|
exec('apt list --upgradable 2>/dev/null | grep "\-security"', $securityUpgrades);
|
|
|
|
// remove listening
|
|
if (isset($securityUpgrades[1])) {
|
|
unset($securityUpgrades[1]);
|
|
}
|
|
}
|
|
|
|
// getting info of files
|
|
exec('echo $(apt list --upgradable 2>/dev/null | grep -v "\-security" | wc -l)', $upgrades);
|
|
|
|
if (isset($upgrades[0]) && intval($upgrades[0]) > 0) {
|
|
exec('apt list --upgradable 2>/dev/null | grep -v "\-security"', $upgrades);
|
|
|
|
// remove listening
|
|
if (isset($upgrades[1])) {
|
|
unset($upgrades[1]);
|
|
}
|
|
}
|
|
|
|
$result = implode("\n", $upgrades);
|
|
}
|
|
}
|