crontab help needed

This is used for general discussion that is not necessarily server-related.
Post Reply
pepedfh
New to forums
New to forums
Posts: 6
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sat Sep 03, 2011 7:39 pm

crontab help needed

Post by pepedfh »

I am new to this crontab and I would like to know how I could use crontab to turn friendlyfire off and on for one day (Fridays).

The path is; dod/server.cfg/mp_friendlyfire 1

I have tried different entries and I have not been successful. I would like to turn mp_friendlyfire 1 (ON) beginning 1 minute before Friday midnight and turn mp_friendlyfire 0 (OFF) 1 minute after Saturday midnight.

It is a Day of Defeat Linux server (1000fps) out of San Jose, Ca. If you need additional information, please let me know.

thank you in advance,
Pepe
.=QUACK=.Major.Pain
This is my homepage
This is my homepage
Posts: 1573
Joined: Sun Jun 26, 2011 8:03 am

Re: crontab help needed

Post by .=QUACK=.Major.Pain »

Not sure if it can be done with cron, but I can take a guess at it.

I think you would create 2 config files for each type of game style you want.

Then you would have to stop the game server, and then launch it using the config file you want in the startup command line.

Then to switch to the other game type, stop the server again, and launch it with the other config file in the startup command line.

For an example, I can use a l4d2 command line:

srcds.exe -game left4dead2 -console -norestart -nocrashdialog +maxplayers 8 +tv_port 27025 +map "c5m1_waterfront" +ip 74.201.57.251 +port 27015 +exec gametype1.cfg

srcds.exe -game left4dead2 -console -norestart -nocrashdialog +maxplayers 8 +tv_port 27025 +map "c5m1_waterfront" +ip 74.201.57.251 +port 27015 +exec gametype2.cfg
Visit gspreviews.com And Rate & Review Your Old & Current GSP's
Find Your GSP Coupons at gspreviews.com/coupons/
pepedfh
New to forums
New to forums
Posts: 6
Joined: Sat Sep 03, 2011 7:39 pm

Re: crontab help needed

Post by pepedfh »

Hi Quack,

First of all, thanks for responding. I believe you have given me some ideas of how it may be able to work. But I think I will be going through some trials and errors before I get it right. On our server we have FFF (Friendly Fire Fridays) and I always need to make the manual changes to turn it on and off. But sometimes I am not available and other Admins forget to modify the server.cfg file. Thanks again Quack.

regards,
Pepedfh
User avatar
Edge100x
Founder
Founder
Posts: 12948
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: crontab help needed

Post by Edge100x »

The way I would do that internally is generally with a script that sends an rcon command to the server, but you should be able to do it with screen, too, if you're running the server in a screen. The command would look like this:

Code: Select all

screen -S yourscreenname -X stuff $'mp_friendlyfire 1\n'
or

Code: Select all

screen -S yourscreenname -X stuff $'mp_friendlyfire 1\n'
So, in your crontab, this would look like:

Code: Select all

59 23 * * Thu /usr/bin/screen -S yourscreenname -X stuff $'mp_friendlyfire 1\n'
1 0 * * Sat /usr/bin/screen -S yourscreenname -X stuff $'mp_friendlyfire 0\n'
(You replied while I was typing this.)
pepedfh
New to forums
New to forums
Posts: 6
Joined: Sat Sep 03, 2011 7:39 pm

Re: crontab help needed

Post by pepedfh »

Wow!!! Thanks guys. Gives me a lot to work with now.. Thanks Edge and Quack.. You guys are certainly knowledgeable.. Again, thanks for the info.

PS: So using an Rcon command would look the same way as the screen script? But changing the syntax to rcon?
regards,
Pepedfh
User avatar
Edge100x
Founder
Founder
Posts: 12948
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: crontab help needed

Post by Edge100x »

Using an rcon command should be similar, but you'd need to apply an rcon tool for that job instead. I don't know of a convenient command-line rcon tool offhand, so the screen solution is probably the easiest.
pepedfh
New to forums
New to forums
Posts: 6
Joined: Sat Sep 03, 2011 7:39 pm

Re: crontab help needed

Post by pepedfh »

Sounds good Edge. I will work with the screen script.

Thank you,
Pepedfh
pepedfh
New to forums
New to forums
Posts: 6
Joined: Sat Sep 03, 2011 7:39 pm

Re: crontab help needed

Post by pepedfh »

Hi Edge,

I was talking to one of the other Admins (on our server) and we need some clarification on what exactly you mean by "with screen" or "in a screen". We rent a Linux DOD server and all we can see and have access to, is the crontab entry. If you can please clarify, we would really appreciate it.

thanks in advance,
pepedfh
User avatar
Edge100x
Founder
Founder
Posts: 12948
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: crontab help needed

Post by Edge100x »

If you have crontab access and this is a server with NFO, then it has to be an unmanaged server, and you should be running it through "screen", as we describe in our setup guide at: http://www.nfoservers.com/forums/viewto ... =67&t=4163
pepedfh
New to forums
New to forums
Posts: 6
Joined: Sat Sep 03, 2011 7:39 pm

Re: crontab help needed

Post by pepedfh »

Hi Edge,

Wow!! Thanks for definitely clarifying it and giving us the link explaining "screen". This definitely helps a lot.

Thanks again,
Pepedfh
Post Reply