← Desenvolvimento

Service SCRIPT para TEAMSPEAK 2

Lida 1186 vezes

Offline

Carlos Faustino 
Membro
Mensagens 396 Gostos 0
Feedback -1

Troféus totais: 24
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 5 Level 4 Level 3 Level 2 Level 1 100 Posts 50 Posts

Andei aqui na minha no teste, de modo a facilitar-me a iniciar os teamspeaks e ver o estado da mesma criei este codigo para me ajudar
Código: [Seleccione]
#!/bin/sh
### BEGIN INIT INFO
# Created by: carlos-faustino.com
# Short-Description: Service Scripts TEAMSPEAK
# Description: init.d script to manage TEAMSPEAK 2
### END INIT INFO
location="/root/tss2_rc2/"

start() {
cd $location; ./teamspeak2-server_startscript start

}

stop()  {

cd $location; ./teamspeak2-server_startscript stop

}

restart()  {

cd $location; ./teamspeak2-server_startscript restart

}
status()  {

echo "Ports and PID of TEAMSPEAK"; netstat -nap | grep server_linux;

}

case "$1" in
        start)
                start
                ;;
        status)
                status
                ;;
        stop)
                stop
                ;;
        restart)
                restart
                ;;
  *)
echo $"Usage: $0 {start|stop|restart|status}"
        exit 1

esac

Este codigo é para ser inserido na /etc/init.d

Como instalar o Codigo

Facam isto: yum -y install nano; nano /etc/init.d/ts

Copiem e colem o codigo, depois editem a parte location; no meu caso o TS2 está no /root/tss2_rc2

Depois facam CTRL + X, carreguem to y e carreguem em enter

Após estes passos façam: chmod 777 /etc/init.d/ts


Apos isto podem usufruir do comando service ts "status|start|stop|restart"

Alguma duvida postem