[UPDATE] - fork process with screen + webserver

This commit is contained in:
2022-03-16 18:05:23 +00:00
parent fc88812101
commit 6cacea01ba
6 changed files with 70 additions and 140 deletions
+34 -41
View File
@@ -5,52 +5,50 @@ PrintRes() {
}
CheckAllEnd() {
Total=$1
Actual=0
for AcutalFile in $(find /tmp/ -name Monithor_\*-tmp)
do
[[ ! -z $(tail -n 1 $ActualFile | grep 'End of') ]] && Acutal=$((Actual + 1))
done
if [[ ${Total} -eq ${Actual} ]]
if [[ ! -f /tmp/webmonithor ]]
then
Total=$1
Actual=0
for ActualFile in $(find /tmp/ -name Monithor_\*-tmp)
do
[[ ! -z $(tail -n 1 $ActualFile | grep 'End of') ]] && Actual=$((Actual + 1))
done
echo '
<html>
<head>
<title>MoniThor on '${RemoteIp}' </title>
<meta http-equiv="refresh" content="'${Rotation}'" />
</head>
<title>MONITHOR</title>
if [[ ${Total} -eq ${Actual} ]]
then
Date : '$(date +'%Y-%m-%d %H:%M:%S')'
echo '
<html>
<head>
<title>MoniThor on '${RemoteIp}' </title>
<meta http-equiv="refresh" content="1" />
</head>
<title>MONITHOR</title>
Date : '$(date +'%Y-%m-%d %H:%M:%S')'
<table border="1" color="#FFFFFF">
<thead>
<tr>
<th colspan="4">MoniThor Result</th>
</tr>
</thead>
<tbody>' > /tmp/webmonithor
<table border="1" color="#FFFFFF">
<thead>
<tr>
<th colspan="4">MoniThor Result</th>
</tr>
</thead>
<tbody>
' > /tmp/webmonithor
cat /tmp/Monithor_*-tmp >> /tmp/webmonithor
cat /tmp/Monithor_* >> /tmp/webmonithor
rm /tmp/Monithor -f
echo '
</tbody>
echo '
</tbody>
</table> ' >> /tmp/webmonithor
mv /tmp/webmonithor ../web/index.html
mv /tmp/webmonithor ../web/index.html
rm /tmp/Monithor_* -f
fi
fi
}
GenerateWebEnd(){
echo '<!--End of '$1'-->'| tee -a $1
echo '<!--End of '$1' '$(pwd)'-->' >> $1
}
@@ -67,13 +65,7 @@ GenerateWeb(){
[[ $Val == "1" ]] && Color=yellow
echo '
<tr>
<td>'$Remote'</td>
<td>'$Sonde'</td>
<td>'$Arg'</td>
<td style="background-color:'${Color}';" > '$Val' </td>
<td> '$Txt'</td>
</tr>' >> ${File}
<tr> <td>'$Remote'</td> <td>'$Sonde'</td> <td>'$Arg'</td> <td style="background-color:'${Color}';" > '$Val' </td> <td> '$Txt'</td> </tr>' >> ${File}
@@ -81,3 +73,4 @@ GenerateWeb(){