-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhldsctl
executable file
·54 lines (46 loc) · 1.01 KB
/
hldsctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash --
PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin'
name='hlds'
basedir="/usr/games/hlds"
command="$1"
prog=`basename $0`
do_start()
{
cd "$basedir"
screen -d -m -S $name $basedir/hlds_run -game cstrike +map de_dust2 -maxplayers 18 -autoupdate -pidfile ./hlds.pid -pingboost 3 -tos -port 27015
}
do_stop()
{
kill `screen -ls | grep -e "\.$name" | awk '{print $1}' | sed -e 's/\..*//g'`
clean_demos
}
clean_demos()
{
cd "$basedir/cstrike/demos"
# clean up over 100MB size demos
find . -type f -name "*.dem" -size +100000k -print0 | xargs -0 rm -f
# clean up over 7days demos
find . -type f -name "*.dem" -ctime +7 -print0 | xargs -0 rm -f
}
do_usage()
{
echo "$prog start - start $name"
echo "$prog stop - stop $name"
echo "$prog restart - restart $name"
}
case "$command" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
do_start
;;
*)
do_usage
;;
esac
exit 0