[UPDATE] - fork process with screen

This commit is contained in:
2022-03-16 15:22:09 +00:00
parent 5ad25fb23d
commit 304043d02f
6 changed files with 92 additions and 42 deletions
+42 -20
View File
@@ -5,16 +5,25 @@ PrintRes() {
}
PrintWeb() {
CheckAllEnd() {
if [[ ! -f /tmp/webmonithor ]] || [[ "$1" == "START_TRATS" ]]
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} ]]
then
echo '
echo '
<html>
<head>
<title>MoniThor on '${RemoteIp}' </title>
<meta http-equiv="refresh" content="'${Rotation}'" />
</head>
<title>MONITHOR</title>
Date : '$(date +'%Y-%m-%d %H:%M:%S')'
@@ -27,35 +36,48 @@ PrintWeb() {
<tbody>
' > /tmp/webmonithor
fi
cat /tmp/Monithor_* >> /tmp/webmonithor
rm /tmp/Monithor -f
if [ "$1" == "END_DNE" ]
then
echo '
echo '
</tbody>
</table> ' >> /tmp/webmonithor
mv /tmp/webmonithor ../web/index.html
mv /tmp/webmonithor ../web/index.html
else
Val=$(echo $1 | cut -d"|" -f1)
Txt=$(echo $1 | cut -d"|" -f2)
Sonde=$2
Arg=$3
Remote=$4
Color=red
[[ $Val == "0" ]] && Color=green
[[ $Val == "1" ]] && Color=yellow
fi
}
echo '
GenerateWebEnd(){
echo '<!--End of '$1'-->'| tee -a $1
}
GenerateWeb(){
Val=$(echo $1 | cut -d"|" -f1)
Txt=$(echo $1 | cut -d"|" -f2)
Sonde=$2
Arg=$3
Remote=$4
File=$5
Color=red
[[ $Val == "0" ]] && Color=green
[[ $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>' >> /tmp/webmonithor
fi
</tr>' >> ${File}
}