how to write a shell script for my CS server

hans007

Lifer
Feb 1, 2000
20,212
17
81
I installed mandrake 7.2 the other day on my other computer. After hours of mucking with it, i figured out how to get a working counterstrike server working. Now i've got to type this long string and well, i want to know how to make a script so i dont have to type

./hlds_run -nomaster +sv_lan 1 -game cstrike +maxplayers 16 +map de_dust


Also is there a wierd problem with the i810 chipset's video with linux because i get wierd screen corruption. Its not really a big deal, but i was just wondering
 

brewty

Senior member
Mar 29, 2000
601
0
76
simple

#!/bin/sh

./hlds_run -nomaster +sv_lan 1 -game cstrike +maxplayers 16 +map de_dust

#eof

then chmod 755 it, and run away...
of course there's plenty of other things you can do... like make it loop automatically if it crashes, etc...
there's a few premade cs server scripts avail (some, or one, on the cs server page).

erm i dunno bout the i810, but search google and you'll prolly find a few ppl w/ similar probs if it's a common prob.
 

chromedubs

Junior Member
Apr 17, 2001
4
0
0
the following is a script i wrote for starting/stoping/restarting the halflife server. its mostly ment to be used as an init script. i wrote it with debian in mind, but it should be reasonably easy to adapt to your distribution.

the script requires start-stop-daemon (part of the debian dpkg system)

http://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_1.8.3.1.tar.gz

and screen

ftp://mirrors.xmission.com/gnu/screen/screen-3.9.8.tar.gz

of course you will need to modify the default values for PATH, DAEMON, HLDIR, and ARGS to match your system's setup.

- c-dubs

script is as follows:

#! /bin/bash
#
# a script for starting/stopping/restarting the halflife server
# by cwj@rootdown.net
#

NAME=hld
PATH=/sbin:/bin:/usr/bin:/sbin:/usr/sbin
HLDIR=/usr/local/halflife/ # path to your hl server
DAEMON=/usr/local/halflife/hlds_run # path to your hlds_run binary
ARGS="-game cstrike -port 27015 +maxplayers 16 +map cs_italy" # arguments to pass to the halflife server
export LD_LIBRARY_PATH=$HLDIR:$LD_LIBRARY_PATH
trap "" 1
export LANG=C

test -f $DAEMON || exit 0

case "$1" in
start)
echo -ne "Starting server: $NAME.\n"
cd $HLDIR
screen -m -d -S hld $DAEMON $ARGS
;;
stop)
echo -ne "Stoping server: $NAME.\n"
start-stop-daemon --stop -x $DAEMON
;;
restart)
echo -ne "Restarting server: $NAME.\n"
start-stop-daemon --stop -x $DAEMON
cd $HLDIR
screen -m -d -S hld $DAEMON $ARGS
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
exit 1
;;
esac
exit 0
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |