About MartNet MartNet Technical Support
Home Services Support Members Software Contact
Search Support
MartNet WebMail

MartNet WebAdmin

Dialup Access
  Numbers

Domain Name
  Management

MartNet News /
  Status Info

NOC / System Status


Support Topics:
 MartNet WebAdmin
 Dial-up
 Virtual Hosting
 Web Site Construction
 Unix / Linux
 E-Mail
 Internet Chat
 Game Server Services
 Misc. Stuff
 Policies / Legal

MartNet Ad



FAQ's:
 MartNet WebAdmin
 Dial-up
 Virtual Hosting
 E-Mail
 Game Server Services
 Misc. FAQ's

Links:
 Privacy and Security
 Dial-up
 Web Development
 E-Mail
 Unix / Linux
 Game Server Services
 Misc. Support Links




MartNet Policies
Billing Dept.

Check Domain
Availability:



Automatically restarting HL / CS with crontab
How to get an automagic restart in case of reboot or crash

Use a crontab entry. Since the start_server command will fail if the server is already running, setting a cronjob to try to run it every 15 minutes or half-hour is safe. If it's running, nothing happens. If it ain't, it'll start.

The format for this is very important. Screwing it up will cause things to Run Amok(tm). If you cause something to Run Amok, the offending process(es) will be slain and your amokmaking priviledges will be revoked, mmmkay? Now, having said that...

Keep a copy in a plain text file

Log in in the usual way. Create a plain text file with no word wrap by entering "pico -w YOURUSERNAME.cron" at the commandline; for instance, if your username was nemesys,
nemesys@shockwave:~$ pico -w nemesys.cron

A crontab entry is 5 fields of timecode followed by the command to be run. For now, we're going to try twice an hour - on the hour and half past - to start the server. Enter in this file we're making:
0,30 * * * * start_server



There are NO spaces in the 0,30 and there MUST be a blank line at the end! After you've typed that, hit "ctrl-x" then "y" to save YOURUSERNAME.cron to your home directory.

To make sure there's a blank line at the end, now type "more NAME.cron," and look to see if it's there:
nemesys@shockwave:~$ more nemesys.cron
0,30 * * * * start_server

nemesys@shockwave:~$

If you see
nemesys@shockwave:~$ more nemesys.cron
0,30 * * * * start_server
nemesys@shockwave:~$

then you need to try again. Without that last blank line, nothing happens.

Assuming you got it right, type "crontab NAME.cron," ferinstance:
nemesys@shockwave:~$ crontab nemesys.cron

And that's it! Your crontab entry has been updated. After a reboot, or should the monitor AND server both die for any reason, it will be automagically brought back a maximum of 30 minutes later. Going and reading something on Crontab probably wouldn't hurt...



This Web Site is proudly built upon an Open Source foundation:
Assembled with PHP Powered by Debian Linux Fueled by MySQL
Served by Apache

Home | Services | Support | Members | Software | Contact

MartNet - PO Box 42472 Philadelphia, PA 19101
Copyright 1996 - 2015 MartNet Communications LLC. All Rights Reserved.