Results 1 to 1 of 1
Threaded View
-
15-02-2004, 00:13 #1vondel Guest
Init-script for Linuxversion of the server
Today I have created an initscript for usage in my server, and I wanted to share it with you. I you have comments, please let me know,
I designed it with this points in mind:
- The server has to be run as another user as root
- The server has to be started at bootup, so it had to be compatible with Debian-scripts
- The script has to do some basic checking at startup/shutdown
As a starting point I used the supplied script with the Linux-serverpackage, hence the given credits. And of course, you may use my part as you wish. It would be nice to include this script in future distributions as the Debian-startup-script.
The only 'unusual' program this script depends on, is 'sudo'. For those unfamiliar with this program I advise to read about it. It's very usefull for most administrators.
Code:#! /bin/bash # Copyright (c) 2002 TeamSpeak team All rights reserved. # # Author: Niels Werensteijn 2002 # Reinder Cuperus 2004 # # MODIFY AS NEEDED: DIR=/home/tss/tss2_rc2 PID=$DIR/tsserver2.pid PROCESS=$DIR/server_linux USER=tss case "$1" in start) if [ ! -f $PID ] then sudo -u $USER $PROCESS -PID=$PID else if kill -CHLD `cat $PID` then echo Server already running else echo PID-file not deleted, server down sudo -u $USER $PROCESS -PID=$PID fi fi ;; stop) if [ -f $PID ] then kill -TERM `cat $PID` echo -n Waiting for process to go down N=0 while [ -f $PID -a $N -lt 10 ] do echo -n . sleep 1 N=$(($N+1)) done if [ -f $PID ] then echo Failed kill -KILL `cat $PID` else echo OK fi else echo "Process ain't running" fi ;; restart) $0 stop && $0 start || return=$rc_failed ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Server Status HTML Script
By nmysytes in forum [TeamSpeak 2] Addons & ScriptsReplies: 3Last Post: 04-06-2004, 18:00 -
Scheisse habe QDSL alles geht nur keine REG
By Creeper in forum [TeamSpeak 2] Server SupportReplies: 6Last Post: 29-08-2002, 09:06 -
TeamSpeak Server won't report Statistics to your Webserver/PHP Script
By T. Boonstra in forum [TeamSpeak Classic] General QuestionsReplies: 0Last Post: 21-06-2002, 21:00


Reply With Quote