This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to VietTUG.org

cstrike: startup script for archlinux user

cstrike hehe
Added by over 2 years ago

Ref.: http://www.cstrike-planet.com/tutorial/1-Linux-Install-CS-Source/5

After you follow installation steps provided in the above link, create a script to start cstrike server. The orangebox directory may be different; on my system, it is /DATA/cs.source/orangebox, and the script is /DATA/cs_start.sh.

1 #!/bin/sh
2 cd /DATA/cs.source/orangebox/ && \
3   ./srcds_run \
4     -game cstrike \
5     +maxplayers 5 \
6     -ip x.x.x.x &

Now the script /etc/rc.d/csd for Arch boot. Please update the path of CS_SCRIPT to fit in your system. You can invoke the game server by /etc/rc.d/csd start. Remember to add csd to your /etc/rc.conf.

 1 #!/bin/bash
 2 
 3 . /etc/rc.conf
 4 . /etc/rc.d/functions
 5 
 6 PID=`pgrep srcds_`
 7 CS_SCRIPT=/DATA/cs_start.sh          # change this
 8 case "$1" in
 9   start)
10     stat_busy "Starting CS daemon" 
11     [ -z "$PID" ] && $CS_SCRIPT >/dev/null 2>&1 &
12     if [ $? -gt 0 ]; then
13       stat_fail
14     else
15       add_daemon csd
16       stat_done
17     fi
18     ;;
19   stop)
20     stat_busy "Stopping CS daemon" 
21     [ ! -z "$PID" ]  && kill $PID > /dev/null
22     if [ $? -gt 0 ]; then
23       stat_fail
24     else
25       rm_daemon csd
26       stat_done
27     fi
28     ;;
29   restart)
30     $0 stop
31     sleep 1
32     $0 start
33     ;;
34   *)
35     echo "usage: $0 {start|stop|restart}"  
36 esac
37 
38 exit 0
39 

NOTE: The csd doesn't work as I expected: Using ps xau you can see that cs_start.sh is available. You may think of invoking srcds_run directly in /etc/rc.d/csd.


Comments