Raised This Month: $51 Target: $400
 12% 

linux startup script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[ck]ruberducky
Member
Join Date: Feb 2009
Location: In the moment
Old 03-21-2009 , 20:46   linux startup script
Reply With Quote #1

hey i was wondering if someone has made a script that automatically starts a counter-strike server upon computer boot.

directions on how to make this startup script would be appreciated.

*server runs on a linux OS
[ck]ruberducky is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-21-2009 , 22:59   Re: linux startup script
Reply With Quote #2

I'm using Fedora Core 6 and I have a ventrilo server that I start on boot up. You just need to put the command in /etc/rc.d/rc.local (plain text file, it should exist already) and it will execute the command on startup.

But, since ventrilo has a daemon it is really simple. HLDS does not have a daemon so what I use is the program called "screen". Do you have Screen or something similar?

If so you can do something like this:

Quote:
Originally Posted by ENNEk View Post
Man, put the command:get with this command.

Code:
screen -A -m -d -S cs27015 ./hlds_run -game cstrike -port 27015 +ip XXX.XXX.XXX.XXX +map de_aztec +maxplayers 26 +sys_tickrate 100 +sv_maxupdaterate 101 +exec server.cfg
With this command... is much lighter than either.

This command is more optimized.
Although, you don't need "+exec server.cfg" since it is already automatically executed.

I have not tested this on boot up though.
__________________
fysiks is offline
[ck]ruberducky
Member
Join Date: Feb 2009
Location: In the moment
Old 03-22-2009 , 23:31   Re: linux startup script
Reply With Quote #3

yea i dont know what exactly that is, but yes i did use screen.
i did (just in case anyone else wants this, and its in linux)

sudo emacs /etc/init.d/start_counterstrike

then in the file....

#!/bin/bash

cd /home/NAME/hlds

screen -d -m ./hlds_run -game cstrike (and so on)

yea i found that way of doing it, it will start in a detached screen. To recover it just type,

sudo screen -r

then to detach it again,

ctrl a d

then just to make it easier i changed the bios to start computer when it is connected to power (just in case the power goes out and im not home to do stuff). pretty much after doing this, you can forget about ever starting your server manually agian. its kinda like a self feeding pet
[ck]ruberducky is offline
[ck]ruberducky
Member
Join Date: Feb 2009
Location: In the moment
Old 03-22-2009 , 23:32   Re: linux startup script
Reply With Quote #4

oh and what does the -A -s do
[ck]ruberducky is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-23-2009 , 00:07   Re: linux startup script
Reply With Quote #5

You still had to do the rc.local stuff right?

Quote:
Originally Posted by [ck]ruberducky View Post
then just to make it easier i changed the bios to start computer when it is connected to power (just in case the power goes out and im not home to do stuff). pretty much after doing this, you can forget about ever starting your server manually agian. its kinda like a self feeding pet
I didn't know you could do that!

Quote:
Originally Posted by [ck]ruberducky View Post
oh and what does the -A -s do
I found a good website for screen commands (man page) http://linux.die.net/man/1/screen.

Cap S lets you give your session a useful name. So, all you need to do is type "screen -r hlds" or something else (I use "hlds").
__________________
fysiks is offline
[ck]ruberducky
Member
Join Date: Feb 2009
Location: In the moment
Old 03-23-2009 , 22:54   Re: linux startup script
Reply With Quote #6

i dont know what "rc.local" stuff is, so i assume not because i didnt do that and it runs fine now.
[ck]ruberducky is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-24-2009 , 00:30   Re: linux startup script
Reply With Quote #7

I'm a bit confused now and I don't think understood your last post . lol Just because you put a script in init.d doesn't mean that it will be run at boot up. You have to put it in rc.d somehow, my method is using rc.local instead of messing with symlinks in one of the runlevels.

EDIT: I just read that Debian doesn't use a rc.local file so I'm assuming you would have to add a symlink to one of the runlevels. . . . Oh, apparently there are commands to add scripts the the run levels, I just always do stuff by hand .
__________________

Last edited by fysiks; 03-24-2009 at 00:40.
fysiks is offline
[ck]ruberducky
Member
Join Date: Feb 2009
Location: In the moment
Old 03-29-2009 , 19:30   Re: linux startup script
Reply With Quote #8

nope you are doing it wrong, you're supposed to use init.d with the chconfig command, because rc.local is "oldschool" style and init.d is just more organized. so i guess it doesnt really matter, but i like things to be organized.
__________________
[ck]ruberducky is offline
Reply



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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode