PABX criado para pesquisas
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.
 
 
 
 
 
 

55 lines
1.1 KiB

#!/bin/bash
#servico Monitor Ramal
# chkconfig: 3 98 99
# description: MonitorRamal Simples IP
RETVAL=0
script="./mntRamal.php"
function start () {
if [ "`ps aux | grep $script | grep -v grep`" != "" ]; then
echo "O script $script em execucao."
exit 1
else
php /var/lib/asterisk/scripts/monitoramento/$script &
echo "iniciado ..."
fi
}
function stop () {
kill `ps aux | grep $script | grep -v "grep" | awk '{print $2}'`
echo "O desligando monitoramento..."
}
function status () {
if [ "`ps aux | grep $script | grep -v "grep"`" != "" ]; then
return="Monitor Ramal Iniciado."
else
return="Monitor Ramal Parado."
fi
echo $return
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 2
start
;;
status)
status
;;
*)
echo "Uso: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL