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.
 
 
 

58 lines
1.2 KiB

#!/bin/bash
#
# chkconfig: 35 90 12
# description: Foo server
#
# Get function from functions library
. /etc/init.d/functions
# Start the service FOO
script="./websocket.php"
script2="./test_services.php"
name="wpp"
start() {
if [ "$(ps aux | grep $script | grep -v grep)" != "" ] && [ "$(ps aux | grep $script2 | grep -v grep)" != "" ]; then
echo "$name em execucao."
exit 1
else
php /var/www/html/aplicativo/integracao/media/websocket/$script &
php /var/www/html/aplicativo/integracao/media/tests/$script2 &
echo "iniciado $name"
fi
}
stop() {
kill $(ps aux | grep $script | grep -v "grep" | awk '{print $2}')
kill $(ps aux | grep $script2 | grep -v "grep" | awk '{print $2}')
echo "Desligando $name"
}
status() {
if [ "$(ps aux | grep $script | grep -v "grep")" != "" ] && [ "$(ps aux | grep $script2 | grep -v "grep")" != "" ]; then
echo "$name Iniciado."
else
echo "$name Parado."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 2
start
;;
status)
status
;;
*)
echo $"usa assim vagabundo: $name {start|stop|restart|reload|status}"
exit 1
;;
esac
exit 0