Hi.

Wouldnt it be better to just use the pidfile instead of the 'ps aux |
grep' hell?

screen -S $name -t $name -A -d -m ./srcds_run -pidfile /var/run/$name.pid
-more options

And then just issue a:
kill $( cat /var/run/$name.pid )

You can issue commands to the server by
screen -S $name -p 0 -X stuff 'map de_dust2^M'

I have my screen guide that I often go back to:
http://freebsd.pvp.se/?f=gnu-screen

There I also have a simple description around allowing multiple users
operate the same screen.

/Bjorn

On Thu, 26 May 2011, Daniel Vogel wrote:

> I'm using a web interface for my servers I made in PHP and I
> experienced similar issues with freezing servers not being able to be
> shut down by any admin except me (via ssh). The solution I use is
> simple.
> Since my web interface names all screens it starts tf_$id (like tf_15)
> I can simply provide a kill switch which would use `ps aux | grep
> tf_15` to get the PID of the screen and then kill it, all in one bash
> script which simply takes the server id as parameter.
> So if you give your screens unique names it's only one PHP and bash
> script that finds and kills the server.
>
> --
> Mit freundlichen GrĂ¼ssen,
> Sincerely Yours,
> Daniel Vogel
>
>
>
> On 26 May 2011 13:31, frostschutz <[email protected]> wrote:
> > On Thu, May 26, 2011 at 10:33:23AM +0200, Eric Riemers wrote:
> >> Only in some cases the instance "hangs" and needs a proper kill or
> >> something similar to restart.
> >
> > If there's any way to reliably detect these hangs, some kind of
> > watchdog cron job that restarts it automatically might be worth
> > looking into.
> >
> > Finding out the cause of those hangs & fixing those would be
> > even better but you can't have everything I guess... :)
> >
> >> I could create a webthingy that it places a file which can be checked with
> >> a crontab and if found restart a screen/process but it sounds like someone
> >> should have been there before me.
> >
> > For running / managing gameservers and other things in screen, I made this:
> >
> > https://github.com/frostschutz/Screen-Manager/blob/master/bin/sm
> >
> > However it does not offer any kind of remote management.
> >
> > If you already have a web service running on the machine, it'd probably be
> > the best / easiest to use option.
> >
> > I used to have a Python daemon that allowed the client to connect through
> > telnet and issue simple commands like ping server, show players, or restart.
> >
> > I'm using SSH instead now, with an authorized_keys entry that restricts
> > the user to a specific action only, so it does not actually give shell
> > access. For example the entry can look like this:
> >
> > command="manage-server.sh",no-agent-forwarding,no-port-forwarding,no-user-rc,no-X11-forwarding
> >  ssh-rsa AAAAQQQQ== AdminName
> >
> > Of course this requires the user to install an SSH client and generate
> > an SSH key, although you can hide this complexity behind a Windows shortcut.
> > Still, a web service would probably be much more comfortable, I just didn't
> > want to install a web server and possibly PHP just for this...
> >
> > Regards
> > frostschutz
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives, 
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlds_linux
> >
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlds_linux
>

_______________________________________________
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