#!/bin/bash
[[ ! -d /var/www/html/monithor ]] && mkdir -p /var/www/html/monithor

pushd /var/www/html/monithor
source /usr/local/bin/monithor-client.d/MoniThorFnct
python3 -m http.server ${1} &


echo '<html>
<head>
<title>MoniThor on '$(hostname)' </title>
        <meta http-equiv="refresh" content="1" />
</head>
<title>MONITHOR</title>

!!!! Initialization !!!! 

Warning : check the config /etc/monithor-client/conf/*cfg

' > index.html

while [[ ! -f /tmp/endmonitor ]] 
	do
		if [[ ! -z $(ls -1 /tmp/ | grep Monithor_.*-tmp) ]]
			then
				CheckAllEnd $2	
				echo INSIDE
		fi
		sleep 1

	done
	




