[UPDATE] Check IP service

This commit is contained in:
Prof Isen 2022-03-17 13:21:22 +01:00
parent 176c779dfd
commit ec27b17ed6
2 changed files with 25 additions and 6 deletions

View File

@ -1,12 +1,22 @@
#!/bin/bash #!/bin/bash
source /etc/monithor-client/service.cfg source /etc/monithor-client/service.cfg
Ip=$(echo $RemoteIp| cut -d":" -f1)
Exit () {
[[ "$1" == "root" ]] && echo "You have to be root ..."
[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
exit
}
if [[ $(id -u) != "0" ]] if [[ $(id -u) != "0" ]]
then then
echo "Not Root" Exit root
exit
fi fi
[[ ! -z $(ifconfig | grep inet | awk '{print $2}' | grep $LocalIp) ]] && Exit Config
if [[ "$1" == "start" ]] if [[ "$1" == "start" ]]
then then

View File

@ -5,12 +5,21 @@ ScriptDir=/usr/local/bin/monithor-server.d/
SondeFile=/etc/monithor-server/sonde.cfg SondeFile=/etc/monithor-server/sonde.cfg
source /etc/monithor-server/service.cfg source /etc/monithor-server/service.cfg
Exit () {
[[ "$1" == "root" ]] && echo "You have to be root ..."
[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
exit
}
if [[ $(id -u) != "0" ]] if [[ $(id -u) != "0" ]]
then then
echo "Not Root" Exit root
exit
fi fi
[[ ! -z $(ifconfig | grep inet | awk '{print $2}' | grep $LocalIp) ]] && Exit Config
[[ "${Crypted}" == "yes" ]] && NcCmd="cryptcat -k ${LocalPassword} -l ${LocalIp} -p ${LocalPort} " || NcCmd="nc -l ${LocalIp} ${LocalPort}" [[ "${Crypted}" == "yes" ]] && NcCmd="cryptcat -k ${LocalPassword} -l ${LocalIp} -p ${LocalPort} " || NcCmd="nc -l ${LocalIp} ${LocalPort}"