Register
It is currently Thu Dec 18, 2014 8:27 pm

Monitor script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed May 20, 2009 6:35 am   

Joined: Wed May 20, 2009 6:28 am
Posts: 1
Hi,

I need a script to monitor if a detached screen is still running and if it doesn't, start the correct script to restart it again :

When I do "screen -ls" I get this output :

There are screens on:
30256.ET-27961 (05/19/2009 05:07:33 PM) (Detached)
23004.ET-27960 (05/14/2009 11:55:54 PM) (Detached)
20465.ET-27962 (05/13/2009 12:09:02 AM) (Detached)
3 Sockets in /var/run/screen/S-etserver.


When one of the names ET-27960, ET-27961, ET-27962 is not in this list, it should start one of the following bash scripts :

./ET-27960.sh , ./ET-27961 or ./ET-27962

The above scripts are very easy. An example of what ET-27960 looks like :

#!/bin/sh
screen -d -m -S ET-27960 /home/etserver/enemy-territory/etded +set fs_homepath /home/etserver/enemy-territory/ +set vm_game 0 +set sv_pure 1 +set dedicated 2 +set net_ip 85.17.138.129 +set fs_game jaymod +set net_port 27960 +set sv_punkbuster 1 +exec server.cfg

Probably very easy for you guys and girls :D


Top
 Profile  
 PostPosted: Mon Jun 01, 2009 7:59 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 229
Location: London - UK
Code:
for iscreen in 27960 27961 27962
do
  if ! screen -ls | grep ET-$iscreen
  then
    ./ET-$iscreen
  fi
done


This assumes that the ./ET-number scripts finish (rather than run continuously). Also not tested but should give you clues :)


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP