[UPDATE] Check IP service
This commit is contained in:
parent
176c779dfd
commit
ec27b17ed6
@ -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
|
||||||
|
|||||||
@ -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}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user