-
Notifications
You must be signed in to change notification settings - Fork 1
/
backup-parse.php
27 lines (26 loc) · 1.09 KB
/
backup-parse.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
$backup='backup-user';
$logfile='/var/log/backup.log';
if(file_exists($logfile))
{
if($filecurs=file_get_contents($logfile))
{
if(strpos($filecurs, 'already running')!==FALSE)
$returnVar[$backup]=array('state'=>'down','reason'=>'backup already running');
else if(strpos($filecurs, 'no vm found')!==FALSE)
$returnVar[$backup]=array('state'=>'down','reason'=>'no vm found');
else if(strpos($filecurs, 'internal error')!==FALSE)
$returnVar[$backup]=array('state'=>'down','reason'=>'internal error');
else if(strpos($filecurs, 'rror')!==FALSE)
$returnVar[$backup]=array('state'=>'down','reason'=>'error');
else if(strpos($filecurs, 'RROR')!==FALSE)
$returnVar[$backup]=array('state'=>'down','reason'=>'error');
else
$returnVar[$backup]=array('state'=>'up');
}
else
$returnVar[$backup]=array('state'=>'down','reason'=>($logfile.' not readable or empty'));
}
else
$returnVar[$backup]=array('state'=>'down','reason'=>($logfile.' not found'));
echo json_encode($returnVar);