Matt Ogborne wrote:
> --
> [ Picked text/plain from multipart/alternative ]
> [2. CS:Source Linux PID's Changing (Matt Ogborne)]
>
> Howdy,
>
> The screen session is called 'CS_SOURCE_PUBLIC', the exact line used to
> start the screen session is:
> screen -dmS CS_SOURCE_PUBLIC ./srcds_run -game cstrike  -autoupdate +map
> de_dust2 +maxplayers 56 -port 27018 -tickrate 33 +fps_max 150
>
> The screen PID stays constant.
>
> When running 'ps -ef' on the command line it returns, this for the screen
> session:
> user   4223     1  0 Nov01 ?        00:00:12 SCREEN -dmS CS_SOURCE_PUBLIC
> ./srcds_run -game cstrike -autoupdate [truncated]
>
> And this for the actual PID, which is the game server (this is the one that
> is changing! At this time its currently PID 18097):
> user  18097  4224 25 Nov06 pts/1    05:22:08 ./srcds_amd -game cstrike
> -autoupdate  [truncated]
>
> I created a file called 'cron' and entered this into it:
> ps -ef | grep screen | grep "CS_SOURCE_PUBLIC" | grep -v grep | awk '( print
> $2 )' > counterstrike.pid
>
> However when the file is ran, this comes back in the console:
> XXX.XXX.XXX.XXX [user: ~/cron ]$ ./cron
> awk: line 1: syntax error at or near print
> XXX.XXX.XXX.XXX [user:  ~/cron ]$
>
> Its created the file called 'counterstrike.pid' although its empty and
> hasn't found the PID.
>
> What I did notice is that the PPID colum after running 'ps -ef' was the
> screen PID, so if we looked for the PPID for 4224 (The master PID of the
> screen) and then took the  PID, that shoudl work??
>
> Matt


Please, please, don't answer to the digest when creating a new thread.
And even if you do, take the time to just delete the digests content.
It's not just Bytes to download, but also fucks up with any proper
formatting (like bottom posting, to pop it out another time in this list
:p).
Instead just create a new message, addressed to
hlds_linux@list.valvesoftware.com
And if you consider to do another post in your topic, consider to cancel
the digest as long as your thread is running. The digest is imho clearly
for readers only (though i'd prefer a decent html-driven interface like
this: http://www.mail-archive.com/hlds_linux@list.valvesoftware.com/
(apparently only supports one two levels per thread; even has a "reply
via email" button, of which I don't know if it's any good for, or
supports threads itself)).


To your topic: you got a syntax error, it has nothing to do with what
you are searching for.
I coulds simply refer to "man awk", but: awk instructions use curly
brackets, not round brackets.
Also you could use the pattern matching of awk (supports logical
operators), and the output of "screen -ls" (might need su, based on
executing user; saves you from the "grep -v").
su - $CS_USER -c "screen -ls" | awk -F . "\$2 ~ /CS_SOURCE_PUBLIC.*/
{print \$1}"

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to