diff --git a/monithor-client/usr/local/bin/monithor-client b/monithor-client/usr/local/bin/monithor-client index 84b1e6f..443fbe6 100755 --- a/monithor-client/usr/local/bin/monithor-client +++ b/monithor-client/usr/local/bin/monithor-client @@ -1,12 +1,22 @@ #!/bin/bash source /etc/monithor-client/service.cfg -if [[ $(id -u) != "0" ]] - then - echo "Not Root" - exit +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" ]] + then + Exit root fi +[[ ! -z $(ifconfig | grep inet | awk '{print $2}' | grep $LocalIp) ]] && Exit Config if [[ "$1" == "start" ]] then diff --git a/monithor-server/usr/local/bin/monithor-server b/monithor-server/usr/local/bin/monithor-server index 13a1481..ee8af4c 100755 --- a/monithor-server/usr/local/bin/monithor-server +++ b/monithor-server/usr/local/bin/monithor-server @@ -5,12 +5,21 @@ ScriptDir=/usr/local/bin/monithor-server.d/ SondeFile=/etc/monithor-server/sonde.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" ]] then - echo "Not Root" - exit + Exit root 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}"