LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-21-2003, 08:50 PM   #1
DylanBlitz
LQ Newbie
 
Registered: Feb 2003
Posts: 2

Rep: Reputation: 0
newb help


I am setting up a gaming server and I wanted to set it up so that if the game isn't running it will start it, wether it's from a reboot or the service died or whatnot. Would a cron job be the best thing for that? And if it is, what would I do? have the cron job run a script that checks the service? if that's the best bet then can someone please point me to a good tutorial for scripts because I have no clue how to write one.
 
Old 02-22-2003, 01:28 AM   #2
Crunch
Member
 
Registered: Feb 2003
Location: York, PA
Distribution: Slackware, FreeBSD, OpenBSD
Posts: 162

Rep: Reputation: 30
First off i'm thinking you should elaborate more on your information (heh i do the same thing when i'm trying to explain something ) sort details aren't the key.. what kind of script are you looking for ? If you need a tutorial there are all sorts over the web, we need to know what kind of script you want to write anyway. So if you help us out by giving us the spoon we will feed you with that spoon (but first hold up your end and at least try looking for the correct script language you would want to use)

;]
 
Old 02-22-2003, 01:38 AM   #3
DylanBlitz
LQ Newbie
 
Registered: Feb 2003
Posts: 2

Original Poster
Rep: Reputation: 0
hmm, not sure what kind of language I'd need to use. What I am doing is going to be running a dedicated battlefield 1942 server on a redhat 7.3 server hosted remotely. So that I don't have to login to shell and start the game up every time it goes down I wanted to make a script that would check and make sure an instance of the executable is running. Then run a cron job to execute the script. If you need any other info let me know, not sure what else you would need.
I was told that a cron job would do it itself but from what I found on the web cron just executes a command and I don't want the server restarted every 5 minutes, just want to check and see if it's running heh.

Thanks for the help and comments btw
 
Old 02-22-2003, 02:14 AM   #4
Crunch
Member
 
Registered: Feb 2003
Location: York, PA
Distribution: Slackware, FreeBSD, OpenBSD
Posts: 162

Rep: Reputation: 30
Well I'm only 15, and I at the moment know nothing about using / setting up servers, i tried some research for you but nothing got accomplished i only found stuff on how to setup a http apache server Sorry If i find anything i'll try and contact you :]
 
Old 02-22-2003, 02:23 AM   #5
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
assuming this runs as 1 program, and does not fork: maybe something like this will work:

Code:
a=`ps aux|grep program | grep -v "grep program"| wc -l`
this is really primitive, but it may give you an idea. this will give you a number of things running as "program". then you can do an if then statement: if greater than/equal 1 (ie. program running) return w/o error, but if not greater than/equal 1 (ie. program not running) then start program and log error.

hope this gives you an idea. This could easily be done in bash with the above code and an if/statement. Again, this is fairly primitive but may get the job done: you would just put the script in crontab to run every 15 minutes or something.
 
Old 02-22-2003, 09:20 AM   #6
mhearn
LQ Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 47
Check out daemontools

We use this on the theoretic.com server to keep the jabber servers running. If one goes down it'll be restarted, if it freezes just do a killall and it'll be restarted.

It can take a bit of work to setup though
 
Old 02-22-2003, 01:51 PM   #7
Crunch
Member
 
Registered: Feb 2003
Location: York, PA
Distribution: Slackware, FreeBSD, OpenBSD
Posts: 162

Rep: Reputation: 30
Thanks for getting my back guys 8) I didn't know what to say really, I never planned on setting up a gaming server on linux :O but now i know what to do... Sorta.. lol
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
way newb simple Linux - Newbie 17 05-13-2005 06:26 PM
Suse Newb: Not Linux Newb rodericj SUSE / openSUSE 9 03-25-2005 11:03 AM
newb looking for help linuxnewb001 Linux - Newbie 1 10-30-2004 10:31 PM
The first step to ascending newb status, acknowledging you're a newb :P LordRaven LinuxQuestions.org Member Intro 1 08-24-2004 06:05 PM
Newb needs help mrengc Linux - Newbie 2 01-11-2003 06:16 PM


All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration