You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
1010 B

#!/bin/bash
#Variaveis
CLIENTE=$([ -e /hdaux/cliente ] && cat /hdaux/cliente)
versao_linux=$(cat /etc/redhat-release | sed 's/[a-zA-Z() ]//g' | cut -d "." -f 1)
EMAIL="suporte@simplesip.com.br"
IP_CENTRAL_SIP=$(ifconfig | grep "inet " | grep -v "127.0.0.1" | awk {'print $2'} | sed -e 's/addr://g'| sed -e 's/^/IP-CENTRAL-SIP:/g')
if [ $(ps aux | grep "ntpd" | grep -v grep | wc -l) == "0" ] ; then
[ "$versao_linux" = "7" ] && /bin/systemctl stop ntpd.service
[ "$versao_linux" = "7" ] && /bin/systemctl stop ntpdate.service
[ "$versao_linux" = "7" ] && /bin/systemctl start ntpd.service
[ "$versao_linux" = "7" ] && /bin/systemctl start ntpdate.servic
[ "$versao_linux" = "6" ] && service ntpd stop
[ "$versao_linux" = "6" ] && sleep 2
[ "$versao_linux" = "6" ] && ntpd -q -g
[ "$versao_linux" = "6" ] && sleep 2
[ "$versao_linux" = "6" ] && service ntpd start
echo -e "Subject: SCRIPT NTP CLIENTE:$CLIENTE \nNTP REINICIADO \n$IP_CENTRAL_SIP" | msmtp -t $EMAIL
fi