Forum

> > CS2D > Servers > Cs2d linux command
Forums overviewCS2D overview Servers overviewLog in to reply

English Cs2d linux command

6 replies
To the start Previous 1 Next To the start

old Cs2d linux command

Marcell
Super User Off Offline

Quote
Create linux service for cs2d server...
Hi

I like to make a cs2d service for linux
so i mean this!

/etc/init.d/cs2d start
The CS2D server is running now!

if i like to stop the server
/etc/init.d/cs2d stop

then restart server
/etc/init.d/cs2d restart

how can i start?

old Re: Cs2d linux command

SD
User Off Offline

Quote
It's not currently possible, but you can try to make it yourself. Note that /etc/init.d is for subsystems that start automatically in boot process. The way Linux starts (and stops) all its subsystems is very simple and modular. Linux provides an elegant and modular way to organize the subsystems initialization. An important fact to think is about subsystems interdependencies. For instance, it makes no sense to start a CS2D server before basic networking subsystem is active. Subsystems are organized under the /etc/init.d directory.
1
2
3
4
5
6
7
8
9
10
11
bash:/etc/init.d# ls -l
-rwxr-xr-x  1 root  root   9284 Aug 13  2001 functions
-rwxr-xr-x  1 root  root   4984 Sep  5 00:18 halt
-rwxr-xr-x  1 root  root   5528 Nov  5 09:44 firewall
-rwxr-xr-x  1 root  root   1277 Sep  5 21:09 keytable
-rwxr-xr-x  1 root  root    487 Jan 30  2001 killall
-rwxr-xr-x  1 root  root   7958 Aug 15 17:20 network
-rwxr-xr-x  1 root  root   1490 Sep  5 07:54 ntpd
-rwxr-xr-x  1 root  root   2295 Jan 30  2001 rawdevices
-rwxr-xr-x  1 root  root   1830 Aug 31 09:29 httpd
-rwxr-xr-x  1 root  root   1311 Aug 15 14:18 syslog
This is a simplified listing of this directory. All installed subsystems put in this directory a control program, which is a script that follows a simple standard described bellow. Your software's files will spread across the filesystems, but you'll want to provide a simple and consistent interface to let the user at least start and stop it. Subsystems architecture promotes this ease-of-use, also providing a way (non obrigatoria) to be automatically started on system initialization. You just have to create your /etc/init.d script following a standard to make it functional.
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#
# /etc/init.d/cs2d
# Subsystem file for CS2D server.
#
# chkconfig: 2345 95 05	
# description: CS2D server daemon
#
# processname: cs2dserver
# config: /etc/cs2d/cs2d.conf
# config: /etc/sysconfig/cs2d
# pidfile: /var/run/cs2d.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Pull in sysconfig settings.
[ -f /etc/sysconfig/cs2d ] && . /etc/sysconfig/cs2d	

RETVAL=0
prog="CS2D"
# Here you put your software's specific command.

start() {	
	echo -n $"Starting $prog:"
	# Here you put your software's specific command.
	RETVAL=$?
	[ "$RETVAL" = 0 ] && touch /var/lock/subsys/$prog
	echo
}

stop() {	
	echo -n $"Stopping $prog:"
	# Here you put your software's specific command.
	killproc $prog -TERM
	RETVAL=$?
	[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/$prog
	echo
}

reload() {	
	echo -n $"Reloading $prog:"
	killproc $prog -HUP
	RETVAL=$?
	echo
}

case "$1" in	
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	reload)
		reload
		;;
	condrestart)
		if [ -f /var/lock/subsys/$prog ] ; then
			stop
			# avoid race
			sleep 3
			start
		fi
		;;
	status)
		status $prog
		RETVAL=$?
		;;
	*)	
		echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
		RETVAL=1
esac
exit $RETVAL
I still find it highly unneeded, if only you will make a service that will start/stop all of your CS2D servers. I have also copied some information from different sources, what I mean is that next time you can try searching first.

old Re: Cs2d linux command

SD
User Off Offline

Quote
Just add -realport parameter right after command which starts CS2D server (implying that you start dedicated server directly, of course). If you have any problems - just send me your script, I'll show you where.

old Script

Marcell
Super User Off Offline

Quote
Spoiler >

old Re: Cs2d linux command

SD
User Off Offline

Quote
1
PARAMS=""
Add -realport there, it would look like this.
1
PARAMS=-realport
Now line 28 of your script, replace with this (let's start server with parameters we have defined).
1
su $user -c "cd $DIR; screen -m -d -S cs2d ./$DAEMON $PARAMS"
You don't need to change anything else, since parameters are already executed when restarting. I'm not sure, but I hope it's gonna work. Good luck!
To the start Previous 1 Next To the start
Log in to reply Servers overviewCS2D overviewForums overview