PDA

View Full Version : [ANY] Server Crontab


Pages : [1] 2

dubbeh
08-25-2007, 19:43
Server Crontab v2.0.0.0

About the plugin:
Run server jobs at certain Minutes, Hours, Days of the Week and Days of the Month. Admins will need the ROOT access flag to Add, Remove or View Cronjobs. To get a better idea of what cronjobs are, check out the official Wikipedia article here (https://en.wikipedia.org/wiki/Cron)

Full documentation and Examples (https://dubbeh.net/sourcemod-plugins/server-crontab/)
Download (https://dl.dubbeh.net/sourcemod/servercrontab/servercrontab_2000.zip)

The actual plugin won't compile directly on the forums because of custom natives. Full source is included in the download.

Have fun, dubbeh :)

MoggieX
08-26-2007, 21:09
Another ace addition!

I was looking at the chron one and decided it was a little OTT, this looks perfect. Will be giving this a bash tomorrow.

BTW really dumb question, does this execute on every map change? As in your example you have used the plugin to change the mapcyclefile, would you remove the mapcyclefile reference from the server.cfg file or just leave it be???

Matt

API
08-27-2007, 02:12
Great job :]

dubbeh
08-27-2007, 14:56
thx pimpinjuice :)

MoggieX this runs the selected config/setting at the specified time in the jobs.ini - recommend to remove the settings you'll be changing from the server.cfg. so it doesn't get reset at every map change :)

next release will include checking that the job.ini settings are in valid ranges & allow the hour option to have a wildcard

Isias
08-27-2007, 16:56
Could you add a roundend / roundstart feature? Not really a cronjob, but would be usefull for several functions.

GCFaith
08-29-2007, 10:01
Thanx for filling my request :) When I have some time im gonna test it :)

Nican
08-29-2007, 10:21
dubbeh wouldn't it be nice if plugins could register cron jobs for their own use?


If you don't know how, I can help you

MoggieX
08-29-2007, 16:05
thx pimpinjuice :)

MoggieX this runs the selected config/setting at the specified time in the jobs.ini - recommend to remove the settings you'll be changing from the server.cfg. so it doesn't get reset at every map change :)

next release will include checking that the job.ini settings are in valid ranges & allow the hour option to have a wildcard

Heya,

Many thanks for clarification for that!

Oh and ty for building it!!!

Matt

dubbeh
08-29-2007, 21:14
>- Isias;524026']Could you add a roundend / roundstart feature? Not really a cronjob, but would be usefull for several functions.

I'll get something like that added in a later version, got a few ideas for the internal structure that will allow jobs like that to be set

@nican nice idea. I could add some stocks RegisterCronJob then return the job index for removal later on & UnregisterCronJob using the job index. I'll have a look into it. Also planning on using the adt array for an unlimited number of jobs soon ;)

Nican
08-29-2007, 23:38
Yay!

If you need help, created the natives, using adt_array, just PM me...

dubbeh
08-30-2007, 07:26
post removed

got the module based plugin released now ;)

Nican
08-30-2007, 09:38
Ok.. how I have 1 comment and 1 idea:

comment: Why did you make all natives already with a defined value of 0 or nothing?

idea: how about a forward "forward OnCronCall(CronId)"?

dubbeh
08-30-2007, 09:54
Why did you make all natives already with a defined value of 0 or nothing?
I thought thats what the value gets set to if someone does RegisterCronJob() without passing any arguments, then it will default all the values to 0.Think it would be better to set the times to -1, so they're out of range & dont get past the initial tests ;)

idea: how about a forward "forward OnCronCall(CronId)"?

With this do you mean when the cronjob is about to run then pass this forward with the id

Nican
08-30-2007, 10:04
1. :O

2. Yes

dubbeh
08-30-2007, 10:12
ah cool i thought that was it

I'll get that added now ;)

dubbeh
08-30-2007, 10:43
Files updated with OnCronCall forward - allows cron jobs to be skipped if the plugin requests it :mrgreen:

edit.
Fixed a couple of small bugs with the global forward

Falco
08-31-2007, 01:17
Can this be done?

Cron a gungame on Thursday all day then return back to regular mapcycle

FlyingMongoose
08-31-2007, 02:21
gungame has an enable/disable cvar does it not?

Now this means gungame will always be loaded, but otherwise...yeah that'd work...the next best thing is setting up a batch file to copy/remove files along with a timer based on your OS, but a lot of people don't have that kind of access to their servers.

Falco
08-31-2007, 02:34
I have access to my server. So would this work then?

// Basic Server Crontab configuration file
//
// # = Weekday. Use * for all days of the week. Format is 0 = Sunday to 6 = Saturday
// # # = Hour of the day. The hour is in 24h format (0-23)
// # # # = Minute of the Hour (0-59)
//

// Load GG on Thursday 5am
4 5 0 "es_load gungame4"

// Unload GG on Friday 5am
5 5 0 "es_unload gungame4"

dubbeh
08-31-2007, 02:59
yeah, that would work fine falco

Falco
08-31-2007, 03:11
yeah, that would work fine falco
Excellent, Thanks for the plugin. Another question, you would put the mapcyclefile in the cstrike folder? // Set the map rotation to aimmaps.txt everyday at 6am
* 6 0 "mapcyclefile aimmaps.txt"

// Set the map rotation to normal.txt everyday at 7pm
* 19 0 "mapcyclefile normal.txt"

dubbeh
08-31-2007, 03:54
I'm sure the mapcycle file is read from the default mod folder ;)

edit.
on another note put up the latest module - fixed a few bugs with the arrays & renamed/added a few more natives ;)

Working on the main frontend atm, new supported commands will be:

bsc_addjob weekday hour minute "cronjob" - Add a new cron job
bsc_removejob cron_id - Remove the cron job using the cron id
bsc_removealljobs - Remove all the current cron jobs
bsc_printjobs - Prints all the current cron jobs & Id's

dubbeh
09-01-2007, 02:02
Plugin updated to v1.0.0.0

Now module based & allows other plugin authors to add/remove their own cronjobs ;)

Learnt quite a alot of new things from rewriting this plugin to be module based

GCFaith
09-04-2007, 19:24
This is a suggestion/idea.
Situation:
Unfortunately we have been facing a lot of crashes in the last few weeks. Just to put you at ease it wasnt BSC ;)
What happened was that it would load the different mapcycle for the time of the day, but after a crash would just go back to its old mapcycle.

Suggestion: Have the cron apply for a period and let it check back with every map switch.

Say mapcycle1 applies from 12:00 till 23:00 when the server crashes and reboots the cron checks what time it is makes sure mapcycle1 is stil the mapcycle in use.

Its an idea and dont know if its possible, but would be sweet.

1695
09-05-2007, 05:58
Is there a timer execution feature ? Like exec "mp_friendlyfire 1" 5 minute after mapchange on every maps...

dubbeh
09-05-2007, 09:24
I'll look into these features for the next release, might rename the plugin to server crontab after these requests have been fulfilled

Will make the plugin more like a nomal server crontab with basic & more advanced features - the next update might take me quite some time with a few parts of the plugin needing quite a big recode

dubbeh
09-13-2007, 10:27
Released version 1.0.1.0


- Plugin renamed from Basic Server Crontab to Server Crontab
- Rewritten/Changed some parts of code to support job start & end times


The syntax for adding jobs has changed a little bit to support job start & end times :)

Extreme_One
01-06-2008, 16:32
Getting an error :

L 01/06/2008 - 19:25:06: SourceMod error session started
L 01/06/2008 - 19:25:06: Info (map "cp_dustbowl") (file "errors_20080106.log")
L 01/06/2008 - 19:25:06: [SM] Native "CloseHandle" reported: Handle b400b3 is invalid (error 3)
L 01/06/2008 - 19:25:06: [SM] Debug mode is not enabled for "sc_module.smx"
L 01/06/2008 - 19:25:06: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug -1 on
L 01/06/2008 - 19:25:06: Error log file session closed.

MoggieX
01-26-2008, 19:06
Getting an error :

L 01/06/2008 - 19:25:06: SourceMod error session started
L 01/06/2008 - 19:25:06: Info (map "cp_dustbowl") (file "errors_20080106.log")
L 01/06/2008 - 19:25:06: [SM] Native "CloseHandle" reported: Handle b400b3 is invalid (error 3)
L 01/06/2008 - 19:25:06: [SM] Debug mode is not enabled for "sc_module.smx"
L 01/06/2008 - 19:25:06: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug -1 on
L 01/06/2008 - 19:25:06: Error log file session closed.

I've got the same with CS:S, looked at the code and had no idea why it was complaining about it :(

SM: 1.0.0.1858

Matt

MoggieX
01-30-2008, 04:11
I posted a thread in the scripting forum here http://forums.alliedmods.net/showthread.php?t=66354 it appears by removing the killtimer function above the line which errors out, it works again.

I have attached the files which I know work on SM ver 1858 or newer!!

Matt

MoggieX
01-30-2008, 04:13
I posted a thread in the scripting forum here http://forums.alliedmods.net/showthread.php?t=66354 it appears by removing the killtimer function above the line which errors out, it works again.

I have attached the files which I know work on SM ver 1858 or newer!!

Matt

BrutalGoerge
02-01-2008, 14:24
I want to use this to set sv_password on fri-sun
but It doesn't seem to be working.

I tried putting the sv_password in a cfg called pass.cfg

sc_addjob 5 0 ? ? ? ? "exec pass.cfg"

=\

CaffeinePowered
02-27-2008, 17:25
Im having some problems getting this plugin to load other plugins and execute admin commands. I'm trying to get it to do the following in a TF2 server.

At 11pm server time switch to a different map cycle, the mapcycle file is int he default tf2 directory with the regular default mapcycle.txt

At 10:59 - set the next map to ctf_2fort
At 10:59 - Disable the load Lock
At 11:00 - Load a LateNight plugin that executes a different config on every map load
At 11:01 - Re-enable the load lock

Repeat this process in reverse at 10am the next morning to undo the changes and go back to 'normal' mode. Any help would be appreciated.


sc_addjob ? ? 23 10 0 0 "mapcyclefile latenightmaps.txt"
sc_addjob ? ? 22 22 58 59 "sm_nextmap ctf_2fort"
sc_addjob ? ? 22 23 59 1 "sm plugins load_unlock"
sc_addjob ? ? 23 23 0 0 "sm plugins load LateNight"
sc_addjob ? ? 23 23 1 2 "sm plugins load_lock"
sc_addjob ? ? 10 23 0 1 "mapcyclefile mapcycle.txt"
sc_addjob ? ? 10 10 0 1 "sm plugins load_unlock"
sc_addjob ? ? 10 10 1 2 "sm plugins unload LateNight"
sc_addjob ? ? 10 10 2 3 "sm plugins load_lock"

DontWannaName
03-12-2008, 02:27
Im having problems with this plugin too. It needs updating to the latest build and its not quite working in TF2. Dubbeh I know you were on the other day, any chance u can update this?

ottobohn
05-09-2008, 05:00
Could you allow a cvar or option that will not execute if over a certain amount of people? I only use your plugin for server reboots at 5am and would rather not reboot it if there are people there. Have it like not execute if there are more than 5 players? Know what I mean? This would be very helpful.

Thanks!

Otto

sirmoe
05-15-2008, 05:17
Could you please update this?

vtsoxluvr
05-31-2008, 21:22
is there any way to use quotes in the command that being executed, im trying to change the hostname, and our hostname has spaces in it

arm5ky
06-01-2008, 04:51
put the command to change the hostname in cfg, and then exec cfg with crontab

zerak
06-11-2008, 19:21
request - diffrent kind of times that can be used as example count downs instead of hardcoding every minute remaining (server reboot)

example on how i mean is:
sc_addjob ? ? 4 4 50 59 "sm_hsay Daily server reboot in %(60 - $minute) minutes"

would give:

Daily server reboot in 10 minutes
Daily server reboot in 9 minutes
...
Daily server reboot in 1 minutes

Sgt-Mess
07-01-2008, 01:35
Can you add more than one crontab such as "mapcyclefile 247dust sm plugins unload mapchooser"

Or Do I have to make a seprate job for each one.

And you should really update your main thread since the old cvars are still on there bsc_.

DontWannaName
07-01-2008, 02:02
Author has been gone since March 6, 2008 :P

Sgt-Mess
07-01-2008, 02:20
Author has been gone since March 6, 2008 :P
Doesn't mean someone else can answer my question.

MoggieX
07-01-2008, 11:56
Can you add more than one crontab such as "mapcyclefile 247dust sm plugins unload mapchooser"

Or Do I have to make a seprate job for each one.

And you should really update your main thread since the old cvars are still on there bsc_.

They would need to be separate lines, as each one is executed very minute or so, when active.

Matt

ottobohn
07-09-2008, 13:01
Any good answer to this?

Want to have it change from 30 minute before map changes to unlimited from 10pm until 6am. Am I doing executing an cfg file that forces the map to change? and then sets the mp_timelimit to 0?

Otto
n00bsalad.net

chikencarnage
09-03-2008, 18:34
Can you load a different map config file for different times of the day? like from 10am to 9pm i want to use cp_dustbowl.cfg but from 9pm to 10am use another one that say, lengths the mp_timelimit?

Molli
09-28-2008, 23:30
its says:

"Plugin failed to compile! Please try contacting the author."

i cant download this plugin??

DontWannaName
09-29-2008, 00:23
Its broke anyways :P

Molli
09-29-2008, 02:04
ok then ^^

Sgt-Mess
10-05-2008, 19:21
Shouldn't this be disapproved if it doesn't work.

bl4nk
10-05-2008, 19:29
its says:

"Plugin failed to compile! Please try contacting the author."

i cant download this plugin??

It requires the .inc file to compile, and the webserver doesn't have that. Just download the precompiled .smx file or compile it locally.

chikencarnage
10-05-2008, 21:04
is anyone using this successfully? I tried using it but it never seemed to work and im guessing by judging by earlier posts im not alone.

Sgt-Mess
10-05-2008, 21:22
Like I said this should probably just be disapproved because I compiled it myself and It doesn't work anymore. I just said <failed> in sm plugins list.

At least for the mods where running which is css, tf2, ins, zps, and ff.

chikencarnage
10-06-2008, 11:04
well i got it to install correctly and got it to run in sourcemod but it never worked properly. I had it set up to read maps from one file during a certain time then read from another file another time. but it just screwed everything up.

necrosect
10-08-2008, 21:26
im not sure if this counts as a valuable contribution - but it works absolutely fine for me,
Windows xp, 1.1.0r2474 (so yeah lil out of date there).

ThatGuy
11-11-2008, 07:49
So far it works for me, you just gotta know what your doing, or else you can easily get confused and mess everything up.

zerak
11-14-2008, 17:26
Line 63 should be commented out or removed in sc_module.sp since closehandle will stop the timer so one doesnt need to both kill and close handle like current version


public OnPluginEnd ()
{
if (g_hJobsTimer != INVALID_HANDLE)
{
// KillTimer (g_hJobsTimer); // <- comment this out to avoid a error on unload
CloseHandle (g_hJobsTimer);
g_hJobsTimer = INVALID_HANDLE;
}

Caught off Guard
11-14-2008, 17:44
worked for me on INS. it could have worked better but it did work.

Natalya[AF]
11-16-2008, 03:33
How often will it execute commands//set variables? Just at the given time or will it do it every map change or something?

zerak
11-16-2008, 04:13
Only at specified times, example I use it to restart the server 5.00 in the morning but you can have it to perform something on regular basis too

Natalya[AF]
11-16-2008, 17:54
Cool. This thing works great. :)

your mom
12-21-2008, 13:41
Could someone help me here... I want to make the server remove the timer at 10pm and re-enable the timer at 10am the next day... I am having some trouble getting the mp_timelimit to execute. Could someone show me how to setup the sc_jobs.cfg, and tell me where & to put the mp_timelimite, and how to get it to execute...

Thank you!

zerak
12-21-2008, 20:35
Think something like this would do the trick :)

// after 10 pm we will have mp_timelimit 20 min
sc_addjob ? ? 22 22 0 1 "mp_timelimit 20"

// after 10 am we will have mp_timelimit 10 min
sc_addjob ? ? 10 10 0 1 "mp_timelimit 10"

Read the cfg file top on what each column mean, and move one minute between end and start if you want it to execute only once.
So in the above example your timelimit would not be guaranteed to be correct incase of a crash since it will only be set once during the day.

your mom
12-21-2008, 23:32
Worked nicely.

Thanx!!!

FlyingMongoose
12-22-2008, 11:18
At line 62 in sc_module:

KillTimer (g_hJobsTimer);
CloseHandle (g_hJobsTimer);


KillTimer calls CloseHandle, the handle will be invalidated thanks to KillTimer, remove CloseHandle.

SaintK
12-29-2008, 16:39
Why is this cronjob running every minute?

The config reads;

sc_addjob ? ? 10 22 ? ? "mapcyclefile day.txt"

sc_addjob ? ? 22 10 ? ? "mapcyclefile night.txt"

In the sourcemod logs is displays every minute;

L 12/29/2008 - 11:42:02: [sc_module.smx] Running cron job "mapcyclefile day.txt"

zhelev81
12-29-2008, 21:58
is this good for restarting your server at certain time of the day and if yes,somebody to explane what I have to configure pls.

Tnx in advance

zerak
12-30-2008, 06:50
yes it is, use the command "quit" (assuming that you have a script that starts it or run linux) and patch the plugin to get rid of those uggly error messages (sc doesn't close correctly) and also be wary of some stuff that doesn't always start correctly :p

zhelev81
12-30-2008, 07:04
My servers are on linux (both) someone has told me that is good to restart them every day is that true ?What do you mean by patch the pluging ?

pls describe what do I have to do to restart them every mornin at 6 o' clock and no other jobs needed,only the restart.

I run 14:02:49 SourceMod Version Information:
SourceMod Version: 1.2.0-dev
SourcePawn Engine: SourcePawn 1.1, jit-x86 (build 1.2.0-dev)
SourcePawn API: v1 = 4, v2 = 2
Compiled on: Dec 3 2008 10:44:44
Build ID: 2441:23f4b300bbc1-dev
http://www.sourcemod.net/

14:03:11 Metamod:Source version 1.7.0
Build ID: 616:8453e69f1827
Loaded As: GameDLL (gameinfo.txt)
Compiled on: Nov 26 2008
Plugin interface version: 10:7
SourceHook version: 4:3
http://www.metamodsource.net/

Tnx for you support

zerak
12-30-2008, 10:58
There is one simple fix that both I and flying mongoose posted about (this page and previous) that cause an ugly error log but doesn't really hurt.

ex from my clan-servers and how they do:
// Reboot the server everyday of the week at 5am
sc_addjob ? ? 5 5 0 1 "quit"Some plugins will give ugly output since they don't like reboot but it works and one can often fix fix those plugins with very little effort :)

zhelev81
12-30-2008, 11:29
i need it for 6 am every morning so I change the 5's to 6's ? i don't want to mess my servers so pls write it for me fo r 6 am every morning.And the plugin u 've attached is a fix or what ?Because there is the same plugin in the first post???

zerak
12-30-2008, 13:11
yes that is correct, at least in theory :P

fix is what post 64 (http://forums.alliedmods.net/showpost.php?p=731454&postcount=64) and 56 (http://forums.alliedmods.net/showpost.php?p=713928&postcount=56) are about (same thing) and its only a error that doesn't really matter more than being ugly (I think) :)

zhelev81
12-30-2008, 20:30
do we need both smx's installed to work ? sc.smx (https://forums.alliedmods.net/attachment.php?attachmentid=20116&d=1189693128) and sc_module.smx (https://forums.alliedmods.net/attachment.php?attachmentid=20117&d=1189693136) ???

zhelev81
01-03-2009, 15:05
this plugin stops my server but not restating it :(

zerak
01-03-2009, 16:33
no but if you run srcds on linux it automaticaly restarts on quit or crash if running windows you should start a script that does the same (look at srcds.com (http://www.srcds.com/db/engine.php?subaction=showfull&id=1097362093))

zhelev81
01-03-2009, 18:50
no but if you run srcds on linux it automaticaly restarts on quit or crash if running windows you should start a script that does the same (look at srcds.com (http://www.srcds.com/db/engine.php?subaction=showfull&id=1097362093))

it's linux and doesnt' restart it :(

kobo1d
01-13-2009, 16:09
this plugin stops my server but not restating it :(

same problem :/

if i type it via rcon to console "quit" it does work and restart,
but via cron it hangs and stays offline allthough the linux process is still running...

any fix ?!

kobo1d
01-15-2009, 10:41
same problem :/

if i type it via rcon to console "quit" it does work and restart,
but via cron it hangs and stays offline allthough the linux process is still running...

any fix ?!


nevermdin, it works now :)
dont know, the first 2 times it didint worked but now it seems to be fine..

zhelev81
01-15-2009, 11:46
for me is not working ... maybe because when I type quit in consolle it doesnt restart at all the server ... I have the RESTART="yes" in my srcds_run

why is that happen ??

any help would be appreceated :shock:

Dark-Master
01-15-2009, 12:57
Is this plugin able to do a task continuously?

Like I want it to say some text every 1 minute.

TowedJumper
01-20-2009, 10:33
Is this plugin able to do a task continuously?

Like I want it to say some text every 1 minute.

This plug-in is probably more suited for txt based cron jobs.

http://forums.alliedmods.net/showthread.php?t=67885

kobo1d
01-21-2009, 16:59
for me is not working ... maybe because when I type quit in consolle it doesnt restart at all the server ... I have the RESTART="yes" in my srcds_run

why is that happen ??

any help would be appreceated :shock:

try with
-autoupdate
in starup command of srcds :)

kobo1d
01-22-2009, 08:46
but i dont understand whats this sc and sc_module ..
which one do i need or do i need both ?!

Nomarky
01-22-2009, 15:11
Installation:
sc.smx -> addons\sourcemod\plugins
sc_module.smx -> addons\sourcemod\plugins
sc_jobs.cfg -> cfg\sourcemod
sc.sp -> addons\sourcemod\scripting
sc_module.sp -> addons\sourcemod\scripting
scrontab.inc -> addons\sourcemod\scripting\include

bizu
02-08-2009, 16:50
Why this "plugin" don't work any more??????????

AcidTester
02-08-2009, 18:51
work

bizu
02-08-2009, 18:56
Not with mapcyclefile cvar :)

Nolongerinthegame
02-13-2009, 18:21
Hey guys was wondering what the right comamnd is for to do this. I want monday to friday to be a normal map cylce but the weekend to be different. After the weekend, it will go back to the normal cycle. How would we do this

Nolongerinthegame
02-19-2009, 13:47
Bump anyone?

krzynek1
02-19-2009, 13:59
try this

sc_addjob 1 5 ? ? ? ? "mapcyclefile normal.txt"
sc_addjob 6 0 ? ? ? ? "mapcyclefile different.txt"

Nolongerinthegame
03-01-2009, 07:53
Right that did not work for some reason, the only way i can change to the weekend mapcycle is by typing "mapcycle weekend.txt" - and thats not practical

I even got the cronjob to exec weekend.cfg with the mapcyclefile line included inside it and that still doesnt work.

I see bizu has had problems with the cvar as well. Might be a widespread problem possibly

krispy101
03-23-2009, 13:10
Hmm, is it possible for you to make it available so I can run a job at a set date of a set month too, so I can remove admins as donators? :D

Thanks, Kris

DeaD_EyE82
06-01-2009, 07:48
Both Plugins failed to compile

Kenny Loggins
07-14-2009, 02:34
So is this working with TF2?

templetonpeck
07-23-2009, 22:25
Also for me the "mapcyclefile" command doesnt work. I wanted to have a daytime and a nighttime cycle. So i tested it some days with mapcycle1.txt (daytime) and mapcycle2.txt (nighttime) - both placed in cstrike (like the normal mapcycle.txt)

Like this:

// Set the map rotation to aimmaps.txt everyday.
// Starting at 1am and ending at 7pm
sc_addjob ? ? 12 23 ? ? "mapcyclefile mapcycle1.txt"

// Set the map rotation to normal.txt everyday.
// After 7pm until the day finishes
sc_addjob ? ? 23 12 ? ? "mapcyclefile mapcycle2.txt"


...but nothing happened.

shustas
07-26-2009, 17:15
Ye, mapcycle not working for some reason

Roadwolf
08-07-2009, 17:32
Greetings there.

I am running this script on my server and I have noticed an issue with the minute variables.

i.e.

5 5 16 18 ? ? will run an event on Friday between 4 and 6 PM and the event will occur every minute.

likewise 5 6 16 18 ? ? will run an event every minute between 4 and 6 on friday and saturday.

But if you try for example... 5 5 16 18 20 40 (to run an event, every minute, between 20 and 40 mins) it will only trigger on the first minute.

Likewise, 5 5 16 18 ? 40 - you would expect to run an event every minute from 4PM to 4:40 PM and again from 5PM to 5:40PM ? This does not happen, and in fact just keeps on triggering the event all the way through.

Likewise, 5 5 16 18 20 ? will only run an event once, and not continue it till the end of the hour.


The minutes and wildcard issue surrounding them seems to be messed up. Can someone tell me I am going crazy.?

ngEAr
08-27-2009, 13:57
Which module should be installed , in order to run it? Since its .smx and it has sourcemod folder.

toString
09-05-2009, 06:57
I wish this plugin was updated. Or someone would create a similar cron plugin. Surprising really as this is such a great idea :(

brokennapkins
10-04-2009, 10:42
Both Plugins failed to compile

I got them to compile by copying and pasting the entire contents of the scrontab.inc file in each file where this file was previously included via "#include <scrontab>". I've made no other modifications to the plugin source and have attached the compiled files.

toString
10-04-2009, 18:42
Does being compiled on the 'latest' sm make any difference than just downloading the pre-compiled ones in the opening post?

Cadav0r
11-02-2009, 14:59
Does a SQL version exist?

Wyrda Ebrithil
12-08-2009, 06:16
this plugin in was working on this one server a week ago, then i disabled it, and now it wont work anymore, and it still works on my local host server (copied smx from there and here)
minimal changes have been made to the server, and none that i would think would cause it to fall apart all of a sudden.

it loads the plugin and i can use the command sc_addjob but it doesnt do anything, it would seem as if the time detection is broken on it some how :/

ATF_Griff
12-14-2009, 13:18
Hey I'm trying to run a certain mapcycle from 2 am to 9 am does this seem setup right?

sc_addjob ? ? 2 9 ? ? "mapcyclefile night.txt"

sc_addjob ? ? 9 2 ? ? "mapcyclefile mapcycle.txt"

Bacardi
02-20-2010, 14:37
If you use this plugin, don't unload it when server run. (Example you want change Warmode_on.cfg via Admin menu)
It will crash server
L 02/20/2010 - 21:30:17: SourceMod error session started
L 02/20/2010 - 21:30:17: Info (map "cs_office") (file "errors_20100220.log")
L 02/20/2010 - 21:30:17: [SM] Native "CloseHandle" reported: Handle 970094 is invalid (error 3)
L 02/20/2010 - 21:30:17: [SM] Displaying call stack trace for plugin "sc_module.smx":
L 02/20/2010 - 21:30:17: [SM] [0] Line 62, sc_module.sp::OnPluginEnd()
L 02/20/2010 - 21:31:00: Error log file session closed.
*edit
Unload not crash yet but when load again back, must right order:
First sc_module.smx
Second sc.smx

bouncer
03-08-2010, 16:12
http://forums.alliedmods.net/images/attach/sp.gif Get Plugin (http://www.sourcemod.net/vbcompiler.php?file_id=20119) or Get Source (http://forums.alliedmods.net/attachment.php?attachmentid=20119&d=1189693186) (sc.sp - 580 views - 6.7 KB) http://forums.alliedmods.net/images/attach/sp.gif Get Plugin (http://www.sourcemod.net/vbcompiler.php?file_id=20120) or Get Source (http://forums.alliedmods.net/attachment.php?attachmentid=20120&d=1189693192) (sc_module.sp - 549 views - 10.4 KB)
Failed to compile on forums, anyone know how to fix this?

gH0sTy
03-09-2010, 01:42
Download the compiled .smx plugins or compile it manually.
The plugins require the scrontab.inc file to compile, that's why the web compiler won't work.

drogas
04-18-2010, 15:39
Help me admins http://www.mani-admin-plugin.com/forums/Smileys/default/smiley.gif

how to write to automatically change the map on the dust 2 from 09:30-14:10 every day and automatically change the server name in the dust 2 arena in sc_jobs.cfg (http://forums.alliedmods.net/attachment.php?attachmentid=20118&d=1189693179) with this plugin : http://forums.alliedmods.net/showthread.php?p=523298?

Thanks in advance

drogas
04-18-2010, 19:14
Help me ALL PLEASE http://www.mani-admin-plugin.com/forums/Smileys/default/smiley.gif

how to write to automatically change the map on the dust 2 from 09:30-14:10 every day and automatically change the server name in the dust 2 arena in sc_jobs.cfg (http://forums.alliedmods.net/attachment.php?attachmentid=20118&d=1189693179) with this plugin : http://forums.alliedmods.net/showthread.php?p=523298?

Thanks in advance

drogas
04-19-2010, 13:24
admin read my problem and help me ?:oops:

ATF_Griff
04-22-2010, 19:01
This causes my TF2 server to freeze sometimes when I restart it.

Don.P1
06-12-2010, 05:08
has anyone an idea how i get it work with two different mapcycle files ? one for day and one for night ?

i edit the sc_job.cfg file :

sc_addjob ? ? 1 14 ? ? "mapcyclefile mapcycle night.txt"
sc_addjob ? ? 14 1 ? ? "mapcyclefile mapcycle.txt"

but there is no effect

pls help !!!

sorry for my bad english !!!

Silesti
07-18-2010, 08:55
This is so great plugin, but i keep getting this error:

L 07/16/2010 - 04:01:57: SourceMod error session started
L 07/16/2010 - 04:01:57: Info (map "cp_yukon_final") (file "errors_20100716.log")
L 07/16/2010 - 04:01:57: [SM] Native "CloseHandle" reported: Handle b100b1 is invalid (error 3)
L 07/16/2010 - 04:01:57: [SM] Displaying call stack trace for plugin "sc_module.smx":
L 07/16/2010 - 04:01:57: [SM] [0] Line 62, sc_module.sp::OnPluginEnd()

Whats wrong?


edit: fix is here http://forums.alliedmods.net/showpost.php?p=731454&postcount=64

einwad
05-09-2011, 07:07
At line 62 in sc_module:
Code:
KillTimer (g_hJobsTimer);
CloseHandle (g_hJobsTimer);


KillTimer calls CloseHandle, the handle will be invalidated thanks to KillTimer, remove CloseHandle.

So, I deleted that first CloseHandle and I was left with:


[57] public OnPluginEnd ()
[58] {
[59] if (g_hJobsTimer != INVALID_HANDLE)
[60] {
[61] KillTimer (g_hJobsTimer);
[62] g_hJobsTimer = INVALID_HANDLE;
[63] }
[64] if (g_hJobsTimeArray != INVALID_HANDLE)
[65] {
[66] ClearArray (g_hJobsTimeArray);
[67] CloseHandle (g_hJobsTimeArray);
[68] g_hJobsTimeArray = INVALID_HANDLE;
[69] }
[70] if (g_hJobsTaskArray != INVALID_HANDLE)
[71] {
[72] ClearArray (g_hJobsTaskArray);
[73] CloseHandle (g_hJobsTaskArray);
[74] g_hJobsTaskArray = INVALID_HANDLE;
[75] }
[76] if (g_hCronCallForward != INVALID_HANDLE)
[77] {
[78] CloseHandle (g_hCronCallForward);
[79] g_hCronCallForward = INVALID_HANDLE;
[80] }
[81] }
[82]
[83] public bool:AskPluginLoad (Handle:myself, bool:late, String:error[], err_max)
[84] {
The problem is that when I try to compile, it says "
sc_module.sp<84> : warning 234: symbol "AskPluginLoad" is marked as deprecated: Use AskPluginLoad2<> instead.

I had scrontab.inc in the includes folder.

sipster19
09-17-2011, 17:16
Replace this with AskPluginLoad:

public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
CreateNative ("SC_AddCronJob", Native_AddCronJob);
CreateNative ("SC_RemoveCronJob", Native_RemoveCronJob);
CreateNative ("SC_SearchCronJobId", Native_SearchCronJobId);
CreateNative ("SC_GetNumberOfCronJobs", Native_GetNumberOfCronJobs);
CreateNative ("SC_GetCronJobFromId", Native_GetCronJobFromId);
CreateNative ("SC_RemoveAllCronJobs", Native_RemoveAllCronJobs);
return APLRes_Success;
}

Larsen
10-30-2011, 23:31
Yah, I can't get this to compile under 1.3.5, 1.3.9, or 1.4. I get "internal error".

@ Sipter: replace what?

*Edit: I also have this:


[has anyone an idea how i get it work with two different mapcycle files ? one for day and one for night ?

i edit the sc_job.cfg file :

sc_addjob ? ? 1 14 ? ? "mapcyclefile mapcycle night.txt"
sc_addjob ? ? 14 1 ? ? "mapcyclefile mapcycle.txt"

but there is no effect

pls help !!!

sorry for my bad english !!!

sipster19
10-30-2011, 23:36
I have attached a version with CloseHandle (g_hJobsTimer); removed and AskPluginLoad replaced with AskPluginLoad2.

Larsen
10-31-2011, 18:59
Both failed to compile :(

theY4Kman
11-04-2011, 17:07
The plug-in needs to be compiled on your own system, as it relies on the .inc file. Download sipster19's sc.sp and sc_module.sp and place them in the sourcemod/scripting folder. Then download the scrontab.inc file from the original plug-in post and place it in the sourcemod/scripting/include folder. To compile the plug-in, you can simply drag sc.sp onto the executable file named spcomp.

That should create the output sc.smx. If it doesn't, you'll have to compile the plug-in in a terminal or command prompt. Open one up (Start -> Run -> type "cmd"), navigate to the sourcemod/scripting folder (cd <location of sourcemod/scripting>), type "./spcomp sc.sp" without the quotes, and press Enter. It'll print some messages explaining why it's not compiling.

Larsen
11-05-2011, 05:52
I tried it under 1.3.9, and 1.4.0 under windows. I used the compile.exe, as the spcomp I'm guessing is for linux compile. It said "internal error"... press any key to exit. I did as you did, DLed sipster's .sp files, put the .inc file in the scripting/include folder, and stillno good :-/

Does it compile on yours?


**Edit: I'll jump on my win7 machine tomorrow and try it there. I'm using win2k on this old piece of crap maybe that's why it's no good lol, cuz I'm still getting internal error, and YES I know how to use dos :-(

sipster19
11-05-2011, 15:32
Here are the exact steps how to compile them:

1. Download sourcemod
2. Extract the addons folder.
3. Navigate to the scripting folder.
4. Delete every sp file and the compile.sh
5. Place my versions of sc.sp and sp_module.sp in the scripting folder.
6. Download the scrotab.inc in the first post.
7. Place it in the scripting/include folder.
8. Run compile.exe
9. Navigate to scripting/compiled. The files are now compiled.

Larsen
11-05-2011, 15:55
Yeah it worked now, sorry for the hassle guys. Didn't realize it wouldn't work on win2000. Worked just fine on this win7 machine.

Also interesting note, is it supposed to be different sizes after I compiled them in different sourcemod versions? The 1.3.9 smxs are bigger than the 1.4.0.

sipster19
11-05-2011, 23:02
I read that sourcemod 1.40 compiles plugins 5x faster. I never read anything that they would be different sizes.

Larsen
11-06-2011, 01:49
I have a config question guys I hope you can help:


// Say reboot notice to server 10 mins prior
// Starting at 7:50:00AM CST
sc_addjob 0 ? 7 7 50 50 "say Server is restarting in 10 minutes!"

// Say reboot notice to server 5 mins prior
// Starting at 7:55:00AM CST
sc_addjob 0 ? 7 7 55 55 "say Server is restarting in 5 minutes!"

// Say reboot center-screen notice to server 45 seconds prior
// Starting at 7:59:15AM CST
sc_addjob 0 ? 7 7 59.25 59.25 "sm_csay Server is restarting in 45 seconds, please reconnect!"

// Say reboot menu-say notice to server 40 seconds prior
// Starting at 7:59:20AM CST
sc_addjob 0 ? 7 7 59.33 59.33 "sm_msay Server is restarting in 40 seconds, reconnect!"

// Say reboot admin-chat notice to server 30 seconds prior
// Starting at 7:59:30AM CST
sc_addjob 0 ? 7 7 59.5 59.5 "sm_say Server is restarting in 30 seconds, reconnect!"

// Reboot the server on Sunday once a week at 8am CST
sc_addjob 0 ? 8 8 0 1 "quit"

// Say reboot notice to server 10 mins prior
// Starting at 7:50:00AM CST
sc_addjob 3 ? 7 7 50 50 "say Server is restarting in 10 minutes!"

// Say reboot notice to server 5 mins prior
// Starting at 7:55:00AM CST
sc_addjob 3 ? 7 7 55 55 "say Server is restarting in 5 minutes!"

// Say reboot center-screen notice to server 45 seconds prior
// Starting at 7:59:15AM CST
sc_addjob 3 ? 7 7 59.25 59.25 "sm_csay Server is restarting in 45 seconds, please reconnect!"

// Say reboot menu-say notice to server 40 seconds prior
// Starting at 7:59:20AM CST
sc_addjob 3 ? 7 7 59.33 59.33 "sm_msay Server is restarting in 40 seconds, reconnect!"

// Say reboot admin-chat notice to server 30 seconds prior
// Starting at 7:59:30AM CST
sc_addjob 3 ? 7 7 59.5 59.5 "sm_say Server is restarting in 30 seconds, reconnect!"

// Reboot the server on Wednesday once a week at 8am CST
sc_addjob 3 ? 8 8 0 1 "quit"

Will this work as I wrote for the notes? Am I able to use decimals like 59.5 to represent 30 seconds before the hour?

Also, does it matter if I use "quit" instead of "_restart"?

Larsen
11-09-2011, 21:48
Thanks guys, I've gotten it configured and working beautifully with your help :)

Anyone use this for something other than switching map rotations and displaying text? I'm sure there's something I'm not thinking of that could make this much more useful.

AlfredSpain
11-19-2011, 05:27
Sorry...

Here are the exact steps how to compile them:

1. Download sourcemod
2. Extract the addons folder.
3. Navigate to the scripting folder.
4. Delete every sp file and the compile.sh
5. Place my versions of sc.sp and sp_module.sp in the scripting folder.
6. Download the scrotab.inc in the first post.
7. Place it in the scripting/include folder.
8. Run compile.exe
9. Navigate to scripting/compiled. The files are now compiled.


compile.exe

Where is this file?

Snake60
11-19-2011, 05:56
Must be in scripting folder

AlfredSpain
11-19-2011, 05:59
scripting/compile.sh?

Snake60
11-19-2011, 06:03
scripting/compile.sh - for Linux
scripting/compile.exe - for Windows

AlfredSpain
11-19-2011, 06:05
ha, ok. sorry.

Sure, I download the version of linux as my server is linux but this machine is windows: S

AlfredSpain
11-19-2011, 06:26
Is total sm compile with the windows for use in a linux server?

This command is correct:

sc_addjob? ? 11 11 0 0 "16,000 mp_startmoney"

AlfredSpain
11-19-2011, 06:27
sc_addjob ? ? 11 11 0 0 "mp_startmoney 16000"

AlfredSpain
11-19-2011, 06:38
yes, work.

ew654
11-19-2011, 11:52
L 11/20/2011 - 01:34:59: Log file closed
L 11/20/2011 - 01:34:59: server_message: "restart"
[EventScripts] shutting down...
[EventScripts] shut down successfully.
L 11/20/2011 - 01:34:59: [SM] Native "CloseHandle" reported: Handle 8c008b is invalid (error 3)
L 11/20/2011 - 01:34:59: [SM] Displaying call stack trace for plugin "sc_module.smx":
L 11/20/2011 - 01:34:59: [SM] [0] Line 62, sc_module.sp::OnPluginEnd()

Crontab is not working. and my server close error. sc.sp, i has sc_moudule.sp file sourcemod 1.40 Compiled.

i want help. i don't speak english. easy explain plz..

mausetot
12-06-2011, 08:31
Hello,
this is my sc_jobs.cfg:


sc_addjob 2 ? 13 ? 58 ? "say Lade Gungameconfig und mache Neustart"
sc_addjob 2 ? 14 ? 0 ? "mapcyclefile ggmaps.txt"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame_afk.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame_bot.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame_config.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame_logging.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame_mapvoting.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame_stats.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load gungame_tk.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load sm_ggdm_elimination.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load sm_ggdm_ragdoll.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load sm_ggdm_spawnprotection.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load sm_ggdm_spawns.smx"
sc_addjob 2 ? 14 ? 0 ? "sm plugins load sm_ggdm_weapons.smx"
sc_addjob 2 ? 14 ? 0 ? "map gg_beacon.bsp"
sc_addjob 2 ? 14 ? 0 ? "quit"

sc_addjob 2 ? 14 ? 18 ? "say Lade Standardconfig und mache Neustart"
sc_addjob 2 ? 14 ? 20 ? "mapcyclefile normal.txt"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame_afk.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame_bot.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame_config.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame_logging.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame_mapvoting.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame_stats.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload gungame_tk.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload sm_ggdm_elimination.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload sm_ggdm_ragdoll.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload sm_ggdm_spawnprotection.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload sm_ggdm_spawns.smx"
sc_addjob 2 ? 14 ? 20 ? "sm plugins unload sm_ggdm_weapons.smx"
sc_addjob 2 ? 14 ? 20 ? "map cs_office"
sc_addjob 2 ? 14 ? 20 ? "quit"
doesn´t works.. only the say and quit parts

Could anybody tell me whats the mistake, please?

Thanks and best regards
mausetot

blue zebra
02-01-2012, 02:43
Anyone can remove the sm log parts from the source? Or create a new convar to disable the log entryes? Now my sm log full with the cronjob log messages. Like these:

L 02/01/2012 - 08:09:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:13:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:14:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:15:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:16:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:16:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:19:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:24:23: [sc_module.smx] Running cron job "Blahblah"
Etc.

The plugin works well anyway.

Nolongerinthegame
02-02-2012, 03:46
Crontab is not working. and my server close error. sc.sp, i has sc_moudule.sp file sourcemod 1.40 Compiled.

i want help. i don't speak english. easy explain plz..

Also had errors in sourcemod logs few months ago but not sure what caused them in the plugin. Will try this mod again and will post any errors

duydangle
02-02-2012, 07:29
Anyone can remove the sm log parts from the source? Or create a new convar to disable the log entryes? Now my sm log full with the cronjob log messages. Like these:

L 02/01/2012 - 08:09:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:13:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:14:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:15:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:16:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:16:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:19:23: [sc_module.smx] Running cron job "Blahblah"
L 02/01/2012 - 08:24:23: [sc_module.smx] Running cron job "Blahblah"
Etc.

The plugin works well anyway.
Check the source code and remove the log line ...

Unreal1
02-03-2012, 21:01
Hey, is it possible to run Cron jobs within few second intervals. For example, if I want to run one Cron job every 30 min, then want to run another Cron job every 30 min, 10 sec. So that after the first job runs, another follows 10 sec later.

Bacardi
02-04-2012, 07:05
Hey, is it possible to run Cron jobs within few second intervals. For example, if I want to run one Cron job every 30 min, then want to run another Cron job every 30 min, 10 sec. So that after the first job runs, another follows 10 sec later.
I would say not possible.
There's one timer what repeat every 60 seconds.
You could add that another job for next minute ?

*
or another plugin what have delayed execute....

blue zebra
02-13-2012, 03:25
Anyone can add a cvar for this great plugin for disable the unstopable log entries in the sm logs?
Or rewrite the code well? It seems the author dont do nothing with this plugin.
More errors see in the plugin, when you try to compile. Askpluginload -> askpluginload2

jeon
03-21-2012, 07:53
HOW DO I MAKE IT

FOR EVERY SECOND

Sillium
03-21-2012, 08:17
You should check your caps lock.

The smallest amount is minutes. So without editing there is no way to do something every second.

DeathMaster
06-01-2012, 01:44
I get the following error scrolling through all of my logs:

L 05/31/2012 - 18:31:23: [SM] Native "CloseHandle" reported: Handle c300bf is invalid (error 3)
L 05/31/2012 - 18:31:23: [SM] Displaying call stack trace for plugin "sc_module.smx":
L 05/31/2012 - 18:31:23: [SM] [0] Line 62, sc_module.sp::OnPluginEnd()

Does anyone know how to fix this?

theY4Kman
06-01-2012, 02:11
I get the following error scrolling through all of my logs:

L 05/31/2012 - 18:31:23: [SM] Native "CloseHandle" reported: Handle c300bf is invalid (error 3)
L 05/31/2012 - 18:31:23: [SM] Displaying call stack trace for plugin "sc_module.smx":
L 05/31/2012 - 18:31:23: [SM] [0] Line 62, sc_module.sp::OnPluginEnd()

Does anyone know how to fix this?

Most likely, the problem lies on lines 61 and 62 of sc_module.sp. Line 61 is KillTimer(g_hJobsTimer), and the next one is CloseHandle(g_hJobsTimer). KillTimer performs the job of CloseHandle, but with extra options, so calling CloseHandle after KillTimer is redundant, and would make the handle invalid in the CloseHandle call.

I've taken out the line and compiled it. Give it a shot.

dubbeh
06-25-2012, 02:16
Not been around these woods for a long time, but going to try and fix all my current plugins slowly. and iron out any bugs that currently exist.

Put together a few fixes and added a new cVar to disable server log output.

v1.0.1.1
- Fixed the server error message when unloading the plugin, with invalid handles from KillTimer
- Enabled a console var to enable/disable job server logging output - This can be edited inside sc_module.cfg
- Small source change for the latest version of sourcemod

Next tasks will be to update the radio plugin and possibly the afk manager

Have fun dubbeh

Quick edit..
Forgot to mention.
If anyone has any bugs in any of my plugins, can you please send me a pm with the sourcemod error output or how to reproduce the problem on a live server.

Thanks

Nolongerinthegame
06-25-2012, 08:13
Welcome back dubbeh, almost 4 years since your last post! Ill test out the contrab mod soon :)

dubbeh
07-05-2012, 04:30
Thanks nelioneil, going to update all my plugins more frequently now ;). Next job is the Match Server Manager to work with the latest CS:S.

Just released a small update today, that fixes the missing timer for the sc_module config and changed to a global versioning.

TnTSCS
07-06-2012, 00:53
yep - gonna install this on my servers now, thank you

paterinvictus
09-16-2012, 10:53
Great plugin, I just need a quick explanation of why there is a Start Day/End Day and Start Hour/End hour?

In the examples Ive seen, the start hour and end hour are usually the same. Could I not just leave out the Start hour Option and just put ? ? ? 5 30 1 for example?

Mitchell
09-16-2012, 11:09
Great plugin, I just need a quick explanation of why there is a Start Day/End Day and Start Hour/End hour?

In the examples Ive seen, the start hour and end hour are usually the same. Could I not just leave out the Start hour Option and just put ? ? ? 5 30 1 for example?

Say if you want to print a messaged every 30 minutes, between the hours of 7am and 7 pm you could or from tuesday to saturday, you could.

paterinvictus
09-16-2012, 18:32
Ok nice, Is there a way I can have it start up on the same map that it rebooted on?

If not, How do I make it so I can start a different map cycle.... I see the "mapcycle normal.txt" example in the cfg, where do i put these .txt files?

rtk
10-23-2012, 11:03
How do I make this to run a specific command at midnight ?

Will this work? :
sc_addjob ? ? 0 0 0 1 "sm_mycommand"
Will this run the command at exactly 00:00 or will it repeat the command until 00:01 ?
I want to run it just once, exactly at midnight

Cain
11-09-2012, 07:25
Anyone with a CSGO server running this??

FireAnt
11-09-2012, 11:10
Anyone with a CSGO server running this??Yes, it work perfekt on csgo.

Cain
11-09-2012, 22:04
Thx Fire!! :)

Wilczek
11-10-2012, 19:19
I can't set two mapcycles in CS:GO (daily with vote at map end, and nightly without it). Can anyone help me, please?

sc_jobs:
//
// Basic Server Crontab configuration file
//
// # = Weekday Start. Format is 0 = Sunday to 6 = Saturday
//
// # # = Weekday End. Format is 0 = Sunday to 6 = Saturday
//
// # # # = Start hour of the day. The hour is in 24h format (0-23)
//
// # # # # = End hour of the day. The hour is in 24h format (0-23)
//
// # # # # # = Start minute of the hour (0-59)
//
// # # # # # # = End minute of the hour (0-59)
//
// Use ? to ignore the current weekday/hour/minute
//
//

// Codziennie uruchamiany mapcycle dzienny.txt.
// Od godziny 8 do 22.59
sc_addjob ? ? 8 22 0 59 "mapcyclefile mapcycle-dzienny.txt"

// Wlaczanie glosowan w mapcycle dziennym.
sc_addjob ? ? 8 22 0 59 "sm_mapvote_endvote 1"

// Codziennie uruchamiany mapcycle nocny.txt.
// Od godziny 23.00 do 07.59
sc_addjob ? ? 23 7 0 59 "mapcyclefile mapcycle-nocny.txt"

// Wylaczanie glosowan w mapcycle nocnym.
sc_addjob ? ? 23 7 0 59 "sm_mapvote_endvote 0"

Plugins:
[SM] Listing 29 plugins:
01 "Admin File Reader" (1.5.0-dev+3652) by AlliedModders LLC
02 "Admin Help" (1.5.0-dev+3652) by AlliedModders LLC
03 "Admin Menu" (1.5.0-dev+3652) by AlliedModders LLC
04 "Advertisements" (0.5.5) by Tsunami
05 "Afk Bomb" (1.5.0) by RedSword / Bob Le Ponge
06 "Anti-Flood" (1.5.0-dev+3652) by AlliedModders LLC
07 "Basic Ban Commands" (1.5.0-dev+3652) by AlliedModders LLC
08 "Basic Chat" (1.5.0-dev+3652) by AlliedModders LLC
09 "Basic Comm Control" (1.5.0-dev+3652) by AlliedModders LLC
10 "Basic Commands" (1.5.0-dev+3652) by AlliedModders LLC
11 "Basic Info Triggers" (1.5.0-dev+3652) by AlliedModders LLC
12 "Basic Votes" (1.5.0-dev+3652) by AlliedModders LLC
13 "Client Preferences" (1.5.0-dev+3652) by AlliedModders LLC
14 "Fun Commands" (1.5.0-dev+3652) by AlliedModders LLC
15 "Fun Votes" (1.5.0-dev+3652) by AlliedModders LLC
16 "GameVoting" (1.1) by Neatek
17 "MapChooser" (1.5.0-dev+3652) by AlliedModders LLC
18 "Nextmap" (1.5.0-dev+3652) by AlliedModders LLC
19 "Map Nominations" (1.5.0-dev+3652) by AlliedModders LLC
20 "Player Commands" (1.5.0-dev+3652) by AlliedModders LLC
21 "QuickDefuse" (0.3) by pRED*, G-Phoenix (translations mod)
22 "Reserved Slots" (1.5.0-dev+3652) by AlliedModders LLC
23 "Rock The Vote" (1.5.0-dev+3652) by AlliedModders LLC
24 "Server Crontab" (1.0.1.2) by dubbeh
25 "Server Crontab Module" (1.0.1.2) by dubbeh

Both mapcycle-dzienny.txt and mapcycle-nocny.txt are placed in default game folder (mods/csgo).

kolya2142
04-30-2013, 14:33
Help

sc_addjob ? ? 16 22 59 30 "mapcyclefile mapcycle_day.txt"

sc_addjob ? ? 23 16 00 15 "mapcyclefile mapcycle_night.txt"

work only mapcyclefile mapcycle_day.txt
mapcyclefile mapcycle_night.txt not work

Weasel
05-04-2013, 20:13
Is there a maximum number of jobs that can be on the schedule? Obviously, if so, the next question is ... what is the limit?

Bittersweet
05-04-2013, 21:10
Is there a maximum number of jobs that can be on the schedule? Obviously, if so, the next question is ... what is the limit?

I use this and I believe it is only limited by your available memory. It shouldn't be an issue unless you plan on scheduling thousands of jobs. You'd probably have performance issues with the operation of the scheduler itself interfering with gameplay before you ran out of RAM to hold the jobs.

Weasel
05-04-2013, 21:23
I ask because, I notice that the output of sc_printjobs doesn't seem to show all my currently configured jobs. However, I do notice the jobs themselves are kicking-off as expected.

Bittersweet
05-04-2013, 21:41
Help

sc_addjob ? ? 16 22 59 30 "mapcyclefile mapcycle_day.txt"

sc_addjob ? ? 23 16 00 15 "mapcyclefile mapcycle_night.txt"

work only mapcyclefile mapcycle_day.txt
mapcyclefile mapcycle_night.txt not work

You are starting at hour 23 and ending at hour 16. The job endings don't really mean anything for what you are trying to do, but your end time has to be the same or after your start time for days, hours, and minutes.

It seems like you want your day cycle to run from 16 to 23, and the night cycle the rest of the time. Since your are just setting a cvar, each job only needs to runs momentarily. You'd have to break it down into 3 jobs any way you do it because of the hours you want to use go from one day into another. The least processor intense way to do it would be to just check once at the specified times you want the change to take place.

sc_addjob ? ? 0 0 0 0 "mapcyclefile mapcycle_night.txt"

sc_addjob ? ? 16 16 0 0 "mapcyclefile mapcycle_day.txt"

sc_addjob ? ? 23 23 0 0 "mapcyclefile mapcycle_night.txt"

This is the least processor intense way to do it. The only problem with it is that if you restart your server, you'll have to set it to day/night manually until the next timeframe.

You could do to check once an hour like this:

sc_addjob ? ? 0 15 0 0 "mapcyclefile mapcycle_night.txt"

sc_addjob ? ? 16 22 0 0 "mapcyclefile mapcycle_day.txt"

sc_addjob ? ? 23 23 0 0 "mapcyclefile mapcycle_night.txt"

Or the most processor intensive way, check every minute:

sc_addjob ? ? 0 15 0 59 "mapcyclefile mapcycle_night.txt"

sc_addjob ? ? 16 22 0 59 "mapcyclefile mapcycle_day.txt"

sc_addjob ? ? 23 23 0 59 "mapcyclefile mapcycle_night.txt"

Bittersweet
05-04-2013, 21:44
I can't set two mapcycles in CS:GO (daily with vote at map end, and nightly without it). Can anyone help me, please?

sc_jobs:
//
// Basic Server Crontab configuration file
//
// # = Weekday Start. Format is 0 = Sunday to 6 = Saturday
//
// # # = Weekday End. Format is 0 = Sunday to 6 = Saturday
//
// # # # = Start hour of the day. The hour is in 24h format (0-23)
//
// # # # # = End hour of the day. The hour is in 24h format (0-23)
//
// # # # # # = Start minute of the hour (0-59)
//
// # # # # # # = End minute of the hour (0-59)
//
// Use ? to ignore the current weekday/hour/minute
//
//

// Codziennie uruchamiany mapcycle dzienny.txt.
// Od godziny 8 do 22.59
sc_addjob ? ? 8 22 0 59 "mapcyclefile mapcycle-dzienny.txt"

// Wlaczanie glosowan w mapcycle dziennym.
sc_addjob ? ? 8 22 0 59 "sm_mapvote_endvote 1"

// Codziennie uruchamiany mapcycle nocny.txt.
// Od godziny 23.00 do 07.59
sc_addjob ? ? 23 7 0 59 "mapcyclefile mapcycle-nocny.txt"

// Wylaczanie glosowan w mapcycle nocnym.
sc_addjob ? ? 23 7 0 59 "sm_mapvote_endvote 0"

Plugins:
[SM] Listing 29 plugins:
01 "Admin File Reader" (1.5.0-dev+3652) by AlliedModders LLC
02 "Admin Help" (1.5.0-dev+3652) by AlliedModders LLC
03 "Admin Menu" (1.5.0-dev+3652) by AlliedModders LLC
04 "Advertisements" (0.5.5) by Tsunami
05 "Afk Bomb" (1.5.0) by RedSword / Bob Le Ponge
06 "Anti-Flood" (1.5.0-dev+3652) by AlliedModders LLC
07 "Basic Ban Commands" (1.5.0-dev+3652) by AlliedModders LLC
08 "Basic Chat" (1.5.0-dev+3652) by AlliedModders LLC
09 "Basic Comm Control" (1.5.0-dev+3652) by AlliedModders LLC
10 "Basic Commands" (1.5.0-dev+3652) by AlliedModders LLC
11 "Basic Info Triggers" (1.5.0-dev+3652) by AlliedModders LLC
12 "Basic Votes" (1.5.0-dev+3652) by AlliedModders LLC
13 "Client Preferences" (1.5.0-dev+3652) by AlliedModders LLC
14 "Fun Commands" (1.5.0-dev+3652) by AlliedModders LLC
15 "Fun Votes" (1.5.0-dev+3652) by AlliedModders LLC
16 "GameVoting" (1.1) by Neatek
17 "MapChooser" (1.5.0-dev+3652) by AlliedModders LLC
18 "Nextmap" (1.5.0-dev+3652) by AlliedModders LLC
19 "Map Nominations" (1.5.0-dev+3652) by AlliedModders LLC
20 "Player Commands" (1.5.0-dev+3652) by AlliedModders LLC
21 "QuickDefuse" (0.3) by pRED*, G-Phoenix (translations mod)
22 "Reserved Slots" (1.5.0-dev+3652) by AlliedModders LLC
23 "Rock The Vote" (1.5.0-dev+3652) by AlliedModders LLC
24 "Server Crontab" (1.0.1.2) by dubbeh
25 "Server Crontab Module" (1.0.1.2) by dubbeh

Both mapcycle-dzienny.txt and mapcycle-nocny.txt are placed in default game folder (mods/csgo).

Same issue as the last post I answered. Your hours have to be consecutive. You cannot put 23 before 7. You'll have to break that down into one more job.

Edit: If the cycle is a daily, 24 hour cycle, start out with something like:
sc_addjob ? ? 0 7 0 0 "sm_mapvote_endvote 0"

sc_addjob ? ? 8 22 0 0 "sm_mapvote_endvote 1"

sc_addjob ? ? 22 23 0 0 "sm_mapvote_endvote 0"

This would run the job once an hour.

kolya2142
06-06-2013, 07:15
Help please
//
// Basic Server Crontab configuration file
//
// # = Weekday Start. Format is 0 = Sunday to 6 = Saturday
//
// # # = Weekday End. Format is 0 = Sunday to 6 = Saturday
//
// # # # = Start hour of the day. The hour is in 24h format (0-23)
//
// # # # # = End hour of the day. The hour is in 24h format (0-23)
//
// # # # # # = Start minute of the hour (0-59)
//
// # # # # # # = End minute of the hour (0-59)
//
// Use ? to ignore the current weekday/hour/minute
//
//

sc_addjob ? ? 14 ? 0 ? "mapcyclefile mapcycle_day.txt"
sc_addjob ? ? 23 ? 0 ? "mapcyclefile mapcycle_night.txt"
sc_addjob ? ? 08 ? 0 ? "mapcyclefile mapcycle_other.txt"




L 06/06/2013 - 14:00:55: [sc_module.smx] Running cron job "mapcyclefile mapcycle_other.txt"

Bittersweet
06-06-2013, 17:12
Help please
//
// Basic Server Crontab configuration file
//
// # = Weekday Start. Format is 0 = Sunday to 6 = Saturday
//
// # # = Weekday End. Format is 0 = Sunday to 6 = Saturday
//
// # # # = Start hour of the day. The hour is in 24h format (0-23)
//
// # # # # = End hour of the day. The hour is in 24h format (0-23)
//
// # # # # # = Start minute of the hour (0-59)
//
// # # # # # # = End minute of the hour (0-59)
//
// Use ? to ignore the current weekday/hour/minute
//
//

sc_addjob ? ? 14 ? 0 ? "mapcyclefile mapcycle_day.txt"
sc_addjob ? ? 23 ? 0 ? "mapcyclefile mapcycle_night.txt"
sc_addjob ? ? 08 ? 0 ? "mapcyclefile mapcycle_other.txt"




L 06/06/2013 - 14:00:55: [sc_module.smx] Running cron job "mapcyclefile mapcycle_other.txt"

Try this instead:

sc_addjob ? ? 14 14 0 1 "mapcyclefile mapcycle_day.txt"
sc_addjob ? ? 23 23 0 1 "mapcyclefile mapcycle_night.txt"
sc_addjob ? ? 8 8 0 1 "mapcyclefile mapcycle_other.txt"

Some of documentation would lead you to believe that the plugin would kill jobs at the "end" time. I don't think that is the case. Also, the plugin won't retry or repeat any jobs just because the end time differs from the start time - as far as I have figured out anyway. As far as I can tell, you get one job start attempt for each sc_addjob line. All that said, you cannot have a job with a start time that is after the end time, or it will never run. For example, this job would never run:

sc_addjob ? ? 9 8 0 0 "exec myconfig.cfg"

The plugin will hold you to keeping your end day/hour/minute >= start day/hour/minute. Other than that, the start/end don't seem to serve any purpose, other than the "end" being a "stop trying" point. You will find some lag time, so depending on the job, your might want to do something like this:

sc_addjob ? ? 14 14 0 5 "mapcyclefile mapcycle_day.txt"
sc_addjob ? ? 23 23 0 5 "mapcyclefile mapcycle_night.txt"
sc_addjob ? ? 8 8 0 5 "mapcyclefile mapcycle_other.txt"

5 minutes is a bit extreme, but just for example. For jobs that just change a cvar, 1 minute should be plenty.

eric0279
08-25-2013, 18:29
Hello,

What would be the format flag to run a server every day at 5:00 order?

Thanks

Bittersweet
08-25-2013, 18:36
Hello,

What would be the format flag to run a server every day at 5:00 order?

Thanks

That English doesn't make any sense - you might want to try asking again another way.

There are no flags, and the plugin won't run at all unless your server is running. It cannot start your server, but it could stop or restart your server.

eric0279
08-25-2013, 20:45
Excuse google translator :-D

how to run a cron job at 5:15 am every day of the week?

Bittersweet
08-26-2013, 13:44
Excuse google translator :-D

how to run a cron job at 5:15 am every day of the week?

Depending on what the job is, something like this:

sc_addjob ? ? 5 5 15 16 "run_my_job"

If there is some reason the job might not start in within a one minute window, give it more time:

sc_addjob ? ? 5 5 15 20 "run_my_job"

eric0279
08-26-2013, 19:51
So Monday to SUNDAY, it will execute the command run_my_job 5:15, I understand?

sc_addjob ? ? 5 5 15 16 "run_my_job"

Bittersweet
08-27-2013, 20:34
So Monday to SUNDAY, it will execute the command run_my_job 5:15, I understand?

sc_addjob ? ? 5 5 15 16 "run_my_job"

Yes, but run_my_job has to be something valid as you would type it into the server console.

eric0279
08-27-2013, 21:11
Thanks !

m22b
08-30-2013, 10:28
sc_addjob ? ? ? ? ? 2 "exec bot.cfg"

bot.cfg :
bot_add
bot_add
bot_add

no bots no errors

last cs:go and sm :(

Bittersweet
08-30-2013, 10:42
sc_addjob ? ? ? ? ? 2 "exec bot.cfg"

bot.cfg :
bot_add
bot_add
bot_add

no bots no errors

last cs:go and sm :(

The syntax is inconsistent. You are starting the job every minute of every hour of every day, but ending it on minute 2 of every hour of every minute of every day. You can't do that. If you want the job to run every hour of every day on minute 2, do this:

sc_addjob ? ? ? ? 2 2 "exec bot.cfg"

As far as the bot.cfg file itself, I don't have CS:GO but those commands should be valid. Check your server logs to make sure that the command "exec bot.cfg" isn't executing. The .cfg may be running but not adding BOTs for some other reason.

m22b
08-30-2013, 13:21
sc_addjob ? ? ? ? 0 0 "exec bot.cfg"
sc_addjob ? ? ? ? 2 2 "exec bot.cfg"
sc_addjob ? ? ? ? 20 20 "exec bot.cfg"

not works :)

In sourcemod\logs i dont see error or logs from cron ......

Bittersweet
08-30-2013, 17:46
sc_addjob ? ? ? ? 0 0 "exec bot.cfg"
sc_addjob ? ? ? ? 2 2 "exec bot.cfg"
sc_addjob ? ? ? ? 20 20 "exec bot.cfg"

not works :)

In sourcemod\logs i dont see error or logs from cron ......

All of the syntax looks correct.

Questions:

What folder is your bot.cfg located? Can you type "exec bot.cfg" on the server command line and it works?

Suggestions:

First, make sure both plugins are loaded and running using the "sm plugins list" command. Both the Server Crontab and Server Crontab Module need to be running, 2 separate plugins.

Second, check and make sure the .cfg isn't running. You need to check your logs in ...\cstrike\logs\ in the timeframes to make sure the command isn't being executed. It probably is, and something else is preventing the desired effect, like another cvar that immeditately removes the BOT you just added. This is what happened on my server when I tested it.

If you still can't figure it out, post the output of "sm plugins list". Then execute "exec bot.cfg" form the server command line, and note what time you did that. Post all cstrike and sm logs that cover the time period when you tried to execute the command manually.

m22b
08-30-2013, 20:01
i try :

bot.cfg >
csgo\cfg <--- Here
csgo\cfg\sourcemod <--- Here

I see this plugin in "sm plugin list"
In logs i dont see anything about your cron plugin
(csgo\logs, sourcemod\logs)

This plugin maybe not work in cs:go .....

Put in console sc_printjobs i dont see any job!.

I delete this plugin from server and my hdd , dont have time for this...

Good luck :)

Bittersweet
08-30-2013, 20:13
i try :

I delete this plugin from server and my hdd...



That's probably not a bad idea. Once you figure out how to run a server and SM, come back and try again. You may want to get help from a better language translator as well.

eric0279
09-09-2013, 11:14
I added :

sc_addjob ? ? 16 16 00 20 "backup_server"
sc_addjob ? ? 16 16 00 20 "say TESSSSSSSSSSTTTTTTTTTTTTTTTTTTTT"

L 09/09/2013 - 15:57:24: [sourcebans.smx] STEAM_1:1:12157180 is NOT banned.
[SC] Cron job "backup_server" added successfully
[SC] Cron job "say TESSSSSSSSSSTTTTTTTTTTTTTTTTTTTT" added successfully

I restarted the server and no work has been carried out, why?

This should've been done at 16:00 and finish at 16:20 or I'm wrong?

Bittersweet
09-09-2013, 12:57
I added :

sc_addjob ? ? 16 16 00 20 "backup_server"
sc_addjob ? ? 16 16 00 20 "say TESSSSSSSSSSTTTTTTTTTTTTTTTTTTTT"



I restarted the server and no work has been carried out, why?

This should've been done at 16:00 and finish at 16:20 or I'm wrong?

I don't see any posts by the OP since #147. Having used this plugin for quite awhile, I can say that some of the documentation is a little misleading, particularly "start" and "end" times. Start times work fine, but what happens at "end" time is simply there won't be another start. There is no killing or terminating a process in any way. That said, your end minutes must be >= start minnutes, despite what is suggested in some of the examples in the .cfg file.

All that said, your syntax looks correct. The jobs should have ran at 16:00. The jobs would end when they end though, not end at 16:20. You should be able to run any job you can run from the server console. Are you sure the jobs didn't run? You should at least be seeing "unknown command" at the time 16:00 in your logs.

eric0279
09-09-2013, 13:38
16:00 = nothing in log file....

even say TESTTTTTTTTTT task does not work.

command "sc_printjobs"
19:39:08 Id<TAB>WeekdayStart<TAB>WeekdayEnd<TAB>HourStart<TAB>HourEnd<TAB>MinuteStart<TAB>MinuteEnd<TAB>Job
0<TAB>?<TAB><TAB>?<TAB>16<TAB><TAB>16<TAB>0<TAB><TAB>20<TAB><TAB>backup_server
1<TAB>?<TAB><TAB>?<TAB>16<TAB><TAB>16<TAB>0<TAB><TAB>20<TAB><TAB>say TESSSSSSSSSSTTTTTTTTTTTTTTTTTTTTedit : i have added in game :
sc_addjob ? ? 19 19 45 45 "say TESSSSSSSSSSTTTTTTTTTTTTTTTTTTTT"

start/end at 19:45 = same :(

L 09/09/2013 - 19:44:56: (DEATH)"Colonel Sanders<22><STEAM_1:0:33828855><Survivor><Producer><ALIVE><62+0><setpos_exact 1033.99 -2037.98 324.03; setang 4.12 -46.30 0.00><Area 544>" killed "infected<226><><Infected><infected><DEAD><-1><setpos_exact 1119.85 -2051.09 280.03; setang -0.00 159.71 0.00><Area 1858>" with "baseball_bat"
L 09/09/2013 - 19:44:57: (DEATH)"Martine<31><STEAM_1:0:33315400><Survivor><Mechanic><ALIVE><23+0><setpos_exact 1025.28 -1962.52 353.97; setang 10.47 -68.84 0.00><Area 544>" killed "infected<101><><Infected><infected><DEAD><-7><setpos_exact 1094.37 -2173.80 280.03; setang -0.00 105.21 0.00><Area 240871>" with "rifle_ak47"
L 09/09/2013 - 19:45:00: LazyPenguin spawned as a SPITTER
L 09/09/2013 - 19:45:00: FindNearbySpawnSpot: Moving LazyPenguin from (912.500000, -2012.500000, 280.031250) to (887.500000, -2075.000000, 290.031250) in a nearby nav area (30766) with max range of 100.000000
L 09/09/2013 - 19:45:06: ThirstyPenguin materialized from spawn mode as a HUNTER

Bittersweet
09-09-2013, 13:49
16:00 = nothing in log file....

even say TESTTTTTTTTTT task does not work.

I've never tried running a say command from the server console...it should work. Did you try sm_say? Post your server and error logs here.

eric0279
09-09-2013, 14:02
Post your serverIP of my server ?

backup_server should work because the plugin will execute the command....

sc_addjob ? ? 20 20 05 05 "sm_say TESSSSSSSSSSTTTTTTTTTTTTTTTTTTTT" >> work

Bittersweet
09-10-2013, 06:15
IP of my server ?

backup_server should work because the plugin will execute the command....

sc_addjob ? ? 20 20 05 05 "sm_say TESSSSSSSSSSTTTTTTTTTTTTTTTTTTTT" >> work

I was telling you to post your logs, both error and server logs. If you got the sm_say command to work, then use that syntax, keeping the start and end minute the same. Which plugin accepts the backup_server command? Is that plugin loaded and running correctly? Try SM PLUGINS LIST.

404UserNotFound
10-29-2013, 03:55
Can this be used to auto-restart the server on a timed interval (i.e. once a week)?

I'm trying to find something to do that, as my server tends to get a tad laggy (not gameplay wise, but animation wise) after running for a few days.

EDIT: So after checking out Dr. McKay's Automatic Steam Update plugin, I see how the plugin restarts the server;

ServerCommand("_restart");Would the full command be "sv_restart"? Once I know what the full command is, I'll be setting this Crontab plugin up to restart my server every Sunday night at midnight.

Sillium
10-29-2013, 06:06
It is just "_restart"

404UserNotFound
10-30-2013, 04:08
It is just "_restart"

Ahh, good to know.

404UserNotFound
11-04-2013, 20:03
Ok, so I'm setting this up and I have a question about the format.

I want to set this up to run every Saturday at 11:59PM, but I'm not sure if I've done this correctly:

sc_addjob 6 6 23 ? 59 ? "_restart"

Bittersweet
11-05-2013, 12:06
Ok, so I'm setting this up and I have a question about the format.

I want to set this up to run every Saturday at 11:59PM, but I'm not sure if I've done this correctly:

sc_addjob 6 6 23 ? 59 ? "_restart"

No, for a job like that which only needs to run once, use this syntax:
sc_addjob 6 6 23 23 59 59 "_restart"

I don't believe you can use the ? token in only a beginning or end, it has to be both (despite the examples in the stock sc_jobs.cfg file). Also, your end cannot precede your beginning (no wrapping around).

sc_addjob 6 6 ? ? 59 59 "myjob" - Runs myjob every hour on Saturday at the 59 minute mark.
sc_addjob 6 6 ? ? 40 59 "myjob" - Runs myjob every minute starting at 40 and ending at 59, every hour on Saturday.
sc_addjob 6 6 11 11 50 40 "myjob" - Invalid, job MIGHT run once at 11:50, I wouldn't count on it.

Basically, use the ? in both the start and end if you want it to run every day, or every hour, or every minute.

sc_addjob ? ? 11 11 0 0 "myjob" - Runs myjob every day at 11AM
sc_addjob ? ? ? ? 0 0 "myjob" - Runs myjob every day, every hour at the top of the hour
sc_addjob 6 6 11 11 ? ? "myjob" - Runs myjob every minute starting at 11AM, every Saturday
sc_addjob 6 6 ? ? ? ? "myjob" - Runs myjob every minute all day every Saturday
sc_addjob ? ? ? ? ? ? "myjob" - Runs myjob every minute all day every day

404UserNotFound
11-05-2013, 12:20
No, for a job like that which only needs to run once, use this syntax:
sc_addjob 6 6 23 23 59 59 "_restart"

I don't believe you can use the ? token in only a beginning or end, it has to be both (despite the examples in the stock sc_jobs.cfg file). Also, your end cannot precede your beginning (no wrapping around).

sc_addjob 6 6 ? ? 59 59 "myjob" - Runs myjob every hour on Saturday at the 59 minute mark.
sc_addjob 6 6 ? ? 40 59 "myjob" - Runs myjob every minute starting at 40 and ending at 59, every hour on Saturday.
sc_addjob 6 6 11 11 50 40 "myjob" - Invalid, job MIGHT run once at 11:50, I wouldn't count on it.

Basically, use the ? in both the start and end if you want it to run every day, or every hour, or every minute.

sc_addjob ? ? 11 11 0 0 "myjob" - Runs myjob every day at 11AM
sc_addjob ? ? ? ? 0 0 "myjob" - Runs myjob every day, every hour at the top of the hour
sc_addjob 6 6 11 11 ? ? "myjob" - Runs myjob every minute starting at 11AM, every Saturday
sc_addjob 6 6 ? ? ? ? "myjob" - Runs myjob every minute all day every Saturday
sc_addjob ? ? ? ? ? ? "myjob" - Runs myjob every minute all day every day

Ok, so I gotta change the job to sc_addjob 6 6 23 23 59 59 "_restart"

Good to know.

Bittersweet
11-06-2013, 08:25
Ok, so I gotta change the job to sc_addjob 6 6 23 23 59 59 "_restart"

Good to know.

Yes, that should do it. You might also want to add something like:

sc_addjob 6 6 23 23 58 58 "sm_csay This server will restart in 1 minute"

to give users a warning so they don't think your server crashed.

404UserNotFound
12-28-2013, 15:13
Question. How would one accommodate timezones? Like, if I wanted to set the time up for central timezone, but the dedi is hosted in say, Quebec?

Bittersweet
12-28-2013, 17:13
Question. How would one accommodate timezones? Like, if I wanted to set the time up for central timezone, but the dedi is hosted in say, Quebec?

Quebec is in the Eastern Time Zone. Since the sun rises in the East, Eastern sees times one hour earlier than Central, or put another way, Central = Eastern - 1 Hour. As far as Daylight Savings goes, you should figure out exactly where in Quebec the server is, and look here:
http://en.wikipedia.org/wiki/Daylight_saving_time_in_Canada#Quebec

Other than the DST thing, if you wanted something to happen at 6AM Central, you'd program for 7AM for a server in the Eastern Time Zone.

sheng
02-13-2014, 04:20
If I understand correctly

0 0 0 0 0 0 means the 00:00 PM of monday, and the job only once?

I want this to change the mapcycle until the other day, or 1 0 0 0 0 0..

I´m allright?

Bittersweet
02-13-2014, 11:40
If I understand correctly

0 0 0 0 0 0 means the 00:00 PM of monday, and the job only once?

I want this to change the mapcycle until the other day, or 1 0 0 0 0 0..

I´m allright?

I don't really understand your question regarding "the other day", but that syntax you have will NOT work. Take a look inside your sc_jobs.cfg file that comes with the plugin. There is documentation in there. When it talks about "end weekday/hour/minute", there is no termination, it's just defining when the job would run. You can have a job that runs only Sunday through Tuesday, every hour, by using 0 2 ? ? 0 0.

What I can tell you from experience is that if you specify an "start" > "end" (as in your example above), it won't work. You "end" must be greater than or equal to "start", i.e "start" <= "end".

If you wanted to change the mapcycle once a week, say on Sunday at midnight, it would look something like this:
sc_addjob 0 0 0 0 0 0 "mapcyclefile my_mapcycle.txt"

Of course, if that job runs and you never restart the server, the mapcycle would stay set to my_mapcycle. If you wanted to change it back on Tuesday at 7:30AM, you'd have to add another job that would look like this:
sc_addjob 2 2 7 7 30 30 "mapcyclefile mapcycle.txt"

The "start" and "end" is more for repeating jobs, such as printing a message. For example:
sc_addjob ? ? 17 21 0 0 "sm_say Welcome to happy hour!"
Would print the message to chat every day at 5PM, 6PM, 7PM, 8PM and 9PM.

If you wanted to print the same message every minute between those same hours, but only on Friday and Saturday, you could do this:
sc_addjob 5 6 17 21 0 59 "sm_say Welcome to happy hour!"

Now here's the catch that I was talking about that isn't really documented. If you wanted it on Sunday as well, you would have to use a separate job, since your "start" cannot be greater than "end" - no rollovers. If you enter something like:
sc_addjob 5 0 17 21 0 59 "sm_say Welcome to happy hour!"

trying to get it to run Friday through Sunday, it won't work, nor can you do that with hours or minutes:
sc_addjob 5 6 22 2 0 0 "sm_say Welcome to happy hour!" <<< Won't work
sc_addjob 5 6 20 0 0 0 "sm_say Welcome to happy hour!" <<< Won't work
sc_addjob 5 6 20 22 0 0 "sm_say Welcome to happy hour!" <<< Will work
sc_addjob 5 6 20 22 0 30 "sm_say Welcome to happy hour!" <<< Will work
sc_addjob 5 6 20 22 45 15 "sm_say Welcome to happy hour!" <<< Won't work

Whenever you have a job you want to repeat that starts in one week and ends in the next, or one day and ends in the next, or one hour and ends in the next, you have to use 2 separate jobs.

Bittersweet
02-22-2014, 12:40
On my server I'm trying to have randomiser on just for Friday, every Friday, then turn off at the end of Friday. It keeps turning on and off and it's getting annoying how it just turns on randomly.
Here's my .cfg:

//RANDOMISER ON
sc_addjob 5 6 0 23 0 0 "tf2items_rnd_enabled 1"
//RANDOMISER OFF
sc_addjob 6 5 0 23 1 59 "tf2items_rnd_enabled 0"


Can someone reply with a code that works?

You can't have and end day/hour/minute that is greater than your start. Try this code:


//RANDOMISER ON
sc_addjob 5 5 0 0 0 0 "tf2items_rnd_enabled 1"
//RANDOMISER OFF
sc_addjob 6 6 0 0 0 0 "tf2items_rnd_enabled 0"

Ejziponken
08-26-2014, 11:10
I dont get it at all with the numbers etc. :D

I want to turn a cvar on and off every day.

ON: 14.00
OFF: 23.00

How would that look like? :P

sc_addjob ? ? 14 14 0 1 "cvar_enabled 1"

sc_addjob ? ? 23 23 0 1 "cvar_enabled 0"

Bittersweet
08-26-2014, 12:55
I dont get it at all with the numbers etc. :D

I want to turn a cvar on and off every day.

ON: 14.00
OFF: 23.00

How would that look like? :P

sc_addjob ? ? 14 14 0 1 "cvar_enabled 1"

sc_addjob ? ? 23 23 0 1 "cvar_enabled 0"

Yes, that will work, but of course something else can always change the cvar. If cvar_enabled is the exact cvar and not just an example, you might want to change the name to something more specific. You also want to make sure that whatever plugin is using the cvar isn't loading it from a .cfg file when the map changes.

Ejziponken
08-26-2014, 13:21
Yes, that will work, but of course something else can always change the cvar. If cvar_enabled is the exact cvar and not just an example, you might want to change the name to something more specific. You also want to make sure that whatever plugin is using the cvar isn't loading it from a .cfg file when the map changes.

It was just an example cvar. :)
And thx for the tip!

me-Shoe
01-04-2015, 07:57
Hey Mates.

I have problems to setup an every hour mapchange:
Currently i have an every 30min Mapchange and it works, but i wanne change it to after 60mins mapA then after 60mins MapB and then after 60mins again MapA.

Is this possible?

asdfxD
01-04-2015, 19:24
hi, thanks for the plugin! i have a question..

restart every day at 6am

sc_addjob ? ? 6 6 0 1 "quit"

is this correct? :)

Bittersweet
01-06-2015, 13:25
hi, thanks for the plugin! i have a question..

restart every day at 6am

sc_addjob ? ? 6 6 0 1 "quit"

is this correct? :)

That should work, providing your server recognizes the "quit" command. You also need to have something else in place to automatically restarts your server when it goes down, otherwise your server will just go down and not come back up. If your server supports it, you could use the "restart" command, but that doesn't always work. Best to use a batch file which automatically restarts your server when it goes down for whatever reason.

asdfxD
01-07-2015, 04:40
That should work, providing your server recognizes the "quit" command. You also need to have something else in place to automatically restarts your server when it goes down, otherwise your server will just go down and not come back up. If your server supports it, you could use the "restart" command, but that doesn't always work. Best to use a batch file which automatically restarts your server when it goes down for whatever reason.

yes, quit works and _restart works also. :)

asdfxD
02-24-2015, 13:44
hi again, should be okay?

every day at 18:00 - 19:00

sv_addjob ? ? 18 18 0 1 "sm_restrict_awp_ct -1"
sv_addjob ? ? 18 18 0 1 "sm_restrict_awp_t -1"
sv_addjob ? ? 19 19 0 1 "sm_restrict_awp_ct 1"
sv_addjob ? ? 19 19 0 1 "sm_restrict_awp_t 1"

:D

Bittersweet
02-24-2015, 17:15
hi again, should be okay?

every day at 18:00 - 19:00

sv_addjob ? ? 18 18 0 1 "sm_restrict_awp_ct -1"
sv_addjob ? ? 18 18 0 1 "sm_restrict_awp_t -1"
sv_addjob ? ? 19 19 0 1 "sm_restrict_awp_ct 1"
sv_addjob ? ? 19 19 0 1 "sm_restrict_awp_t 1"

:D

Your syntax for this plugin is valid, but I'm not sure about the sm_restrict_* cvars. If those commands work directly in your server console, then they'll work at the specified times. That would take another plugin to restrict weapons, and that plugin would have to be running at the specified times.

If you are using this plugin (https://forums.alliedmods.net/showthread.php?t=105219), then you'll be allowing unlimited AWPs in the specified hour, and a limit of 1 per team the rest of the time.

The only way I could see this failing is in the unlikely event that a server restart occurs at just the right time, this plugin loads, and your job runs before the weapons restrict plugin loads - in which case you'd get "invalid command" or something like that back from your server.

asdfxD
02-24-2015, 23:25
Your syntax for this plugin is valid, but I'm not sure about the sm_restrict_* cvars. If those commands work directly in your server console, then they'll work at the specified times. That would take another plugin to restrict weapons, and that plugin would have to be running at the specified times.

If you are using this plugin (https://forums.alliedmods.net/showthread.php?t=105219), then you'll be allowing unlimited AWPs in the specified hour, and a limit of 1 per team the rest of the time.

The only way I could see this failing is in the unlikely event that a server restart occurs at just the right time, this plugin loads, and your job runs before the weapons restrict plugin loads - in which case you'd get "invalid command" or something like that back from your server.

yep, i'm using this plugin and the cvars are working throught the console. thanks for your reply.

Lannister
04-06-2015, 14:28
sc_addjob ? ? 15 16 ? ? "sm_umc_endvote_cyclefile umc_mapcycle3.txt"
sc_addjob ? ? 16 ? ? ? "sm_umc_endvote_cyclefile umc_mapcycle.txt"

It always load the default umc_mapcycle, am i doing something wrong?

Do i need to restart the server or something after adding a job?

Azerja12
04-08-2015, 01:56
Where does the name Crontab come from?
Also, welcome back happyhour!

Great Plugin!

DarkDeviL
04-08-2015, 09:08
Where does the name Crontab come from?
Also, welcome back happyhour!

Great Plugin!

Cron is the job scheduler in Linux/UNIX-like systems.

A crontab ("Cron table") file is holding list of tasks it executes at the given interval / time of day.

See: http://en.wikipedia.org/wiki/Cron

Bittersweet
04-08-2015, 19:17
sc_addjob ? ? 15 16 ? ? "sm_umc_endvote_cyclefile umc_mapcycle3.txt"
sc_addjob ? ? 16 ? ? ? "sm_umc_endvote_cyclefile umc_mapcycle.txt"

It always load the default umc_mapcycle, am i doing something wrong?

Do i need to restart the server or something after adding a job?

It looks like what you are trying to do is change the UMC mapcycle file for 1 hour every day, then change it back. Try this:

sc_addjob ? ? 15 15 0 0 "sm_umc_endvote_cyclefile umc_mapcycle3.txt"
sc_addjob ? ? 16 16 0 0 "sm_umc_endvote_cyclefile umc_mapcycle.txt"

This will change the cvar at 3PM, and change it back at 4PM. However, UMC may load that value from one of it's config files at each map change.

Lannister
04-28-2015, 15:31
I put here what i want to do

sc_addjob ? ? 13 14 ? ? "sm_cvar command"
sc_addjob ? ? 13 14 ? ? ""sm_rcon hostname name 1"
sc_addjob ? ? 15 16 ? ? "sm_cvar command 2"
sc_addjob ? ? 15 16 ? ? "sm_rcon hostname name2"

How ever, it only shows the "command 1 and command2" in the crontab, but the "hostname" doesn't appear at all, and it doesn't change my server name it may be because i'm duplicating "sc_addjob ? ? 13 14 ? ?" with 2 commands?

Bittersweet
04-28-2015, 16:23
I put here what i want to do

sc_addjob ? ? 13 14 ? ? "sm_cvar command"
sc_addjob ? ? 13 14 ? ? ""sm_rcon hostname name 1"
sc_addjob ? ? 15 16 ? ? "sm_cvar command 2"
sc_addjob ? ? 15 16 ? ? "sm_rcon hostname name2"

How ever, it only shows the "command 1 and command2" in the crontab, but the "hostname" doesn't appear at all, and it doesn't change my server name it may be because i'm duplicating "sc_addjob ? ? 13 14 ? ?" with 2 commands?

Server Crontab can only execute commands that you could normally execute in the server's command window. Only command lines that you can type into the command window will work. Try doing what you are doing without using RCON. You also realize that what you are trying to do there is change your server name every minute, even though you are changing it back to the same name?

You also have some syntax issues there. I believe hostname requires it's parameter to be enclosed in quotes, and I'm not sure if you can create a cvar that way without providing an initial value. If it's an existing cvar, you aren't changing it in any way with what you are doing.

Why don't you try to explain what it is you want to do, and I will show you how to do it with crontab.

Lannister
04-28-2015, 16:55
Server Crontab can only execute commands that you could normally execute in the server's command window. Only command lines that you can type into the command window will work. Try doing what you are doing without using RCON. You also realize that what you are trying to do there is change your server name every minute, even though you are changing it back to the same name?

You also have some syntax issues there. I believe hostname requires it's parameter to be enclosed in quotes, and I'm not sure if you can create a cvar that way without providing an initial value. If it's an existing cvar, you aren't changing it in any way with what you are doing.

Why don't you try to explain what it is you want to do, and I will show you how to do it with crontab.

Hello, it worked well since the beggining but, i had to restart the server to refresh the crontab config, now it works correctly, thanks for your help

dubbeh
04-29-2015, 04:24
Thanks for the various help with the plugin while i was on an extended break xD.

Just released v1.0.1.3 with a few small changes and added a check finally for duplicate jobs.


v1.0.1.3
- Added a check for duplicate cron jobs getting added and a new native SC_DoesCronJobExist
- Plugin now checks for a duplicate job being added with the new native
- Rebuilt on the latest sourcepawn compiler
Might eventually get around to creating a seperate more advanced module to do stuff on round start, round end etc. possibly call it sc_module_events and have it as an optional addon with cvars to limit what you want to hook.

heavenrave
05-05-2015, 08:33
can i check with you it follows the server timing right ? Because, when I type ingame thetime, my server display 12pm, it doesn't follow my local time. So I did the adjustment of sm_time_adjustment 28800 , thetime becomes 8pm. My cronjob timing do I set 8pm or 12pm? As I've tried setting at 8pm it doesn't change my mapcycle.txt file.

heavenrave
05-05-2015, 08:39
Another seperate issue is
sc_addjob ? ? 7 7 0 0 "sm_map de_dust2" <--- I want it to changemap at 7am everyday. However the job keeps executing, causing my server to keep changing map consecutively without stopping.

sc_addjob ? ? 7 7 0 1 "sm_map de_dust2" <--- do i set it like this instead??? i saw the example of // # # # # # # = End minute of the hour (0-59) So I think, I do not need to bother about the 1 ?

Snaggle
05-05-2015, 10:12
Try 0 7 * * * instead.

heavenrave
05-05-2015, 12:00
Try 0 7 * * * instead.

there is only 5 digits??? not 6 ??


* 0 7 * * *

u meant like this ?

asdfxD
05-05-2015, 12:24
there is only 5 digits??? not 6 ??


* 0 7 * * *u meant like this ?

no, use this: sc_addjob ? ? 7 7 0 1 "changelevel de_dust2"

why? cause i am using ? ? 6 6 0 1 "_restart" and it works everyday at 6 am.

Bittersweet
05-05-2015, 15:02
Another seperate issue is
sc_addjob ? ? 7 7 0 0 "sm_map de_dust2" <--- I want it to changemap at 7am everyday. However the job keeps executing, causing my server to keep changing map consecutively without stopping.

sc_addjob ? ? 7 7 0 1 "sm_map de_dust2" <--- do i set it like this instead??? i saw the example of // # # # # # # = End minute of the hour (0-59) So I think, I do not need to bother about the 1 ?

Yes, the "end" times can be misleading. There is no termination sent out, crontab just stops trying at the end. For what you are doing, either syntax should work. I know that crontab won't do anything if your start number is lower than your end number, for example sc_addjob ? ? 7 7 1 0 "sm_map de_dust2", will never execute. Have you tried using a different command, such as changelevel instead of sm_map? Try:
sc_addjob ? ? 7 7 0 0 "changelevel de_dust2"

Of course, this will change the map at the specified time no matter what is happening in the server (i.e. people playing another map).

heavenrave
05-07-2015, 08:07
Id WeekdayStart WeekdayEnd HourStart HourEnd MinuteStart MinuteEnd Job
0 ? ? 12 21 ? ? mapcyclefile mapcycle3.txt
1 ? ? 21 12 ? ? mapcyclefile mapcycle2.txt

Hmmm, its not executing the above mapcycle3 at 12pm. Should I change anything from there :O

heavenrave
05-07-2015, 08:15
I tried with

sc_addjob ? ? 12 12 0 0 "mapcyclefile mapcycle3.txt"
sc_addjob ? ? 21 21 0 0 "mapcyclefile mapcycle2.txt"

it still isn't executing though :P , on csgo.

Bittersweet
05-07-2015, 14:50
I tried with

sc_addjob ? ? 12 12 0 0 "mapcyclefile mapcycle3.txt"
sc_addjob ? ? 21 21 0 0 "mapcyclefile mapcycle2.txt"

it still isn't executing though :P , on csgo.

First, make sure that the command "mapcyclefile mapcycle3.txt" is changing your map cylce file. If a command doesn't work in the server console, it won't work with crontab either. If it works in the console, try this:

sc_addjob ? ? 12 12 0 1 "mapcyclefile mapcycle3.txt"
sc_addjob ? ? 21 21 0 1 "mapcyclefile mapcycle2.txt"

heavenrave
05-08-2015, 09:52
Weird that it aint working for somereason mapcyclefile is unknown command, so I've use sc_addjob ? ? 12 12 0 1 "sm_cvar mapcyclefile mapcycle3.txt"

it still doesn't execute the mapcycle3.txt job >.<

Bittersweet
05-08-2015, 14:15
Weird that it aint working for somereason mapcyclefile is unknown command, so I've use sc_addjob ? ? 12 12 0 1 "sm_cvar mapcyclefile mapcycle3.txt"

it still doesn't execute the mapcycle3.txt job >.<

Like I said, if the command won't work in your console, it won't work in crontab. What game are you running?

heavenrave
05-08-2015, 22:19
Like I said, if the command won't work in your console, it won't work in crontab. What game are you running?

CsGo. hmmm,

Bittersweet
05-09-2015, 15:34
CsGo. hmmm,

Yeah, hmmmm. According to Valve's developer's community list of cvars (https://forums.alliedmods.net/showthread.php?t=207240), mapcyclefile is supported, however, I'm find much to the contrary on general internet searches. Seems there's more involved with map cycles in CS:GO than there was in previous versions of CS. Take a look at this, it may shed some light:
https://forums.alliedmods.net/showthread.php?t=207240

Correction: That was a list of CS:S cvars. This list (http://steamcommunity.com/sharedfiles/filedetails/?id=275969700) of CS:GO commands from the Steam community does not include mapcyclefile.

Weasel
06-03-2015, 20:10
I believe the mapcyclefile option can only be used when the server is first started, i.e. ...

In the SRCDS command-line, or
In the autoexec.cfg file.

Beyond that, yeah as I recall map-cycles on CS:GO have their own weirdness. But, for other SRCDS games, the above caveat should apply.

Bittersweet
06-04-2015, 12:53
I believe the mapcyclefile option can only be used when the server is first started, i.e. ...

In the SRCDS command-line, or
In the autoexec.cfg file.

Beyond that, yeah as I recall map-cycles on CS:GO have their own weirdness. But, for other SRCDS games, the above caveat should apply.

autoexec.cfg is nice because it will only execute once per server startup (unless called from elsewhere), but anything that happens in there should be able to happen from the server command line or any other .cfg file. I'm not sure about the current state of CS:GO, but the post I linked to previously does say that mapcyclefile had been removed as a cvar, but remains as a command line switch for SRCDS, and one possible workaround is shown there.

dubbeh
08-02-2015, 17:43
Thanks Bittersweet and Weasel for giving lots of help in this post, you're much better than me with updated knowledge on how things changed with CS:GO.

Shame that they restricted so many options in CS:GO, had a couple of issues within another plugin because of the way stuff changed (restrictions basically). Would say they're really pushing for a clean competitive game, which is a shame for anyone coming from Source or 1.6. Then again the original 1.6 was based around an intercept dll created by botman? from the old half life engine a long time ago, from what i can remember

dubbeh
08-09-2015, 08:43
Sorry for the double post - Looking for some feedback on a change I'm thinking about doing.

How would server admins be if i changed the format to be more like the official UNIX cronjob scheduler? Looked over the Wikipedia article and thought it would be much better overall and create less confusion.

# * * * * * command to execute
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
That's how the new format would be like - And potentially add macros for stuff like @startup, @mapchange - Only downside to this, is possibly more overhead on the server.

Freel free to check out the wikipedia article here (https://en.wikipedia.org/wiki/Cron) and give any potential feedback

Bittersweet
08-09-2015, 16:05
Sorry for the double post - Looking for some feedback on a change I'm thinking about doing.

How would server admins be if i changed the format to be more like the official UNIX cronjob scheduler? Looked over the Wikipedia article and thought it would be much better overall and create less confusion.

# * * * * * command to execute
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
That's how the new format would be like - And potentially add macros for stuff like @startup, @mapchange - Only downside to this, is possibly more overhead on the server.

Freel free to check out the wikipedia article here (https://en.wikipedia.org/wiki/Cron) and give any potential feedback

Most of the confusion has been over the "stop" times. I think people take this to mean there is some sort of termination sent out to kill the process, rather than what is actually happening - the command is no longer sent. Removing the "stop" time might make it more clear that most common uses require at least 2 lines - one to change something at a certain time, and another to change it back. Most people seem to use this to change their mapcycles during peak periods, and they often think that the mapcycle will revert back somehow at the "stop" time, when in fact that is the sort of job where then stop time is not relevant, and the user would need a whole other config line to change the mapcycle back. There's also some other quirks with the current syntax. If "Start Time > Stop Time", whether "Time" is hour, minute, etc., the job will never run, and that may be >= instead of just >, I don't remember off hand and can't test it right now, but I know I've posted about it in this thread before.

On the other hand, you should probably add comments in the documentation somewhere clarifying the proposed new syntax because I can hear the questions now..."What day of week do I put if it's a monthly job?", or vice versa. There's a very large chunk of people that would post the question before they would run a simple test to find out.

dubbeh
08-09-2015, 17:43
Thanks for the feedback Bittersweet

I see exactly what you mean about syntax and how users will find it quite daunting. When I initially programmed this - I have no idea why i made it quite complex in the first place and avoided the simple crontab format (Didn't implement overlapping value checking - only if the input was in a valid range. Which is another potential problem without understanding the format). Think if I switched to the much more simple input with minute, hour and day, many users would find it easier.

100% agree about the documentation problems - Was a main thing for me to clean up next, after finishing the radio documentation yesterday.

Will get around to switching the input format without all the extra start and end times, and change the wildcard to "*". Only allow minute, hour and day for now then gradually extend if it's requested. Make sure all users know, that each job is a single task, unless you use a full set of wildcards in every input

Bittersweet
08-10-2015, 14:43
Thanks for the feedback Bittersweet

I see exactly what you mean about syntax and how users will find it quite daunting. When I initially programmed this - I have no idea why i made it quite complex in the first place and avoided the simple crontab format (Didn't implement overlapping value checking - only if the input was in a valid range. Which is another potential problem without understanding the format). Think if I switched to the much more simple input with minute, hour and day, many users would find it easier.

100% agree about the documentation problems - Was a main thing for me to clean up next, after finishing the radio documentation yesterday.

Will get around to switching the input format without all the extra start and end times, and change the wildcard to "*". Only allow minute, hour and day for now then gradually extend if it's requested. Make sure all users know, that each job is a single task, unless you use a full set of wildcards in every input

When you say "day", as long as you mean day of week, I think that's perfect for gameservers. There could be some stuff you'd want to run once a month on a particular day, like the 1st or 15th, but that's most database stuff and can usually be done another way. I think the majority of the current users of this plugin use it to change mapcycles during peak hours. I have used it in the past to run a job every couple of hours that changed some startup sound another plugin played to a new player whenever they joined the server.

The only downside I could see to simplifying things the way you so, is that a user may need more individual jobs, but once a user gets the syntax down, that's all copy and paste - like if you want something to run every hour during a certain 4 hour daily peak time, you'd need 4 lines rather than being able to do it in one.

dubbeh
08-10-2015, 17:40
Yep, day would mean day of the week, to stop any type of confusion on the format - Feel this is the easiest method to impliment and most efficient.

More i thought about it, more promising it was to add a months option, because of the jobs you could run at certain times of the year. Say for example, It's christmas season - You could run all the custom maps with a christmassy feel to them. Or Haloween - Run a mod that gives all the standard maps a dark gloomy feel.

Last potential option - Jobs based on events, like sc_addjob_event @startup, @shutdown, @mapstart, @mapend, @roundstart, @roundend then a delay option - Say for example "sc_addjob_event @startup delaytimer "job"".
Not too sure about the extra overhead from this though, and If It's really worth It.

balonfx
08-11-2015, 13:37
Amazing plugin overall, but I will agree the first thing I thought when opening the plugin was "I wish these reflected the UNIX crons". It was confusing the first time setting it up, being so used to how UNIX has crons already.

Regardless,
Many thanks!

Bittersweet
08-12-2015, 13:31
Yep, day would mean day of the week, to stop any type of confusion on the format - Feel this is the easiest method to impliment and most efficient.

More i thought about it, more promising it was to add a months option, because of the jobs you could run at certain times of the year. Say for example, It's christmas season - You could run all the custom maps with a christmassy feel to them. Or Haloween - Run a mod that gives all the standard maps a dark gloomy feel.

Last potential option - Jobs based on events, like sc_addjob_event @startup, @shutdown, @mapstart, @mapend, @roundstart, @roundend then a delay option - Say for example "sc_addjob_event @startup delaytimer "job"".
Not too sure about the extra overhead from this though, and If It's really worth It.

That is an excellent point about the different holiday seasons. I had both Halloween and Thanksgiving/Christmas holiday themes on my server, but I had to do most of the changes manually. Having Crontab do it for you would be great.

dubbeh
08-14-2015, 13:56
Release should be ready for sunday at the latest. Using the official UNIX job formats and added a couple of little helper variable.

sc_module_hour_add - Adjust the hour value positively by this amount - Minimum 0 and Maximum 12
sc_module_hour_sub - Adjust the hour value negatively by this amount - Minimum 0 and Maximum 12

Allows admins to make sure jobs always run in the timezone they want - Say for example your server timezone is 2 hours behind localtime (Your current location) and you want jobs to run at GMT or something. set "sc_module_hour_add 2.0" and "sc_module_hour_sub 0.0" to make the jobs run at your local timezone.

This will apply to the returned hour value directly in the main crontab timer - When checking if a task needs to be executed. Saves adding entries and working out the time difference inside the main jobs config.

Quick Edit:
Changed from hour_add and hour_sub to just use hour_adjust now - Two variables was unecessary with console variables being able to use negative values.

dubbeh
08-15-2015, 17:32
Removed.. Not using github for now at least.

dubbeh
08-25-2015, 13:45
v2.0.0.0 is now released, documentation is linked to my blog (https://dubbeh.net/sourcemod-plugins/server-crontab/) and still have to add documentation for the natives.

Changelog:
- Recoded the plugin to use new decals
- Crontabs are now based on the official UNIX format - Read up more about them here (https://en.wikipedia.org/wiki/Cron)
- Added checks for a valid number of parameters - To avoid any potential problems

Have fun

Trans_Am_00
10-29-2015, 19:38
Am i doing it right?

/ Reboot the server everyday at 5am - Watch out with this resetting any changes you set inside crontab
sc_addjob 0 5 * * * "_restart"

//Server restart MSG
sc_addjob 55 4 * * * "say Server restarting in 5 mins"
//Server restart MSG
sc_addjob 56 4 * * * "say Server restarting in 4 mins"
//Server restart MSG
sc_addjob 57 4 * * * "say Server restarting in 3 mins"
//Server restart MSG
sc_addjob 58 4 * * * "say Server restarting in 2 mins"
//Server restart MSG
sc_addjob 59 4 * * * "say Server restarting in 1 mins"

dubbeh
11-13-2015, 09:07
Hey, that looks fine. Just double check the actual _restart command, usually "quit" works for most servers running under a restart script.

Bittersweet
11-13-2015, 15:22
Interesting changes, but good. I've never used the Unix cron, so I'm left wondering, what happens when your config has a value of 0, or otherwise outside the acceptable parameters, for day and month? Hopefully just an error message which is logged at the time the config is loaded.

igotfits
01-27-2016, 04:02
Great plugin!
The "say hello!" command works well but "rcon changelevel ctf_2fort" does not work. any idea?

404UserNotFound
01-27-2016, 04:32
Great plugin!
The "say hello!" command works well but "rcon changelevel ctf_2fort" does not work. any idea?

Remove "rcon", or try "sm_rcon" instead.

Bittersweet
01-27-2016, 16:06
Great plugin!
The "say hello!" command works well but "rcon changelevel ctf_2fort" does not work. any idea?

The plugin runs from inside the server, so there shouldn't be any need to use any rcon in any of your commands.

dubbeh
02-02-2016, 19:40
Interesting changes, but good. I've never used the Unix cron, so I'm left wondering, what happens when your config has a value of 0, or otherwise outside the acceptable parameters, for day and month? Hopefully just an error message which is logged at the time the config is loaded.

Anything out of bounds when you add a job will return ThrowNativeError, small code snippet to give an example:


iJobTime[JOB_MINUTE] = GetNativeCell(1);
if (!SC_IsMinuteValid(iJobTime[JOB_MINUTE]))
return ThrowNativeError(SP_ERROR_NATIVE, "Minute value is out of range - Maximum value is 59");

iJobTime[JOB_HOUR] = GetNativeCell(2);
if (!SC_IsHourValid(iJobTime[JOB_HOUR]))
return ThrowNativeError(SP_ERROR_NATIVE, "Hour value is out of range - Maximum value is 23");

iJobTime[JOB_DAY_OF_THE_MONTH] = GetNativeCell(3);
if (!SC_IsDayOfTheMonthValid(iJobTime[JOB_DAY_OF_THE_MONTH]))
return ThrowNativeError(SP_ERROR_NATIVE, "Day of the month value is out of range - Minumum 1 - Maximum 31");

iJobTime[JOB_MONTH] = GetNativeCell(4);
if (!SC_IsMonthValid(iJobTime[JOB_MONTH]))
return ThrowNativeError(SP_ERROR_NATIVE, "Month value is out of range - Minumum 1 - Maximum 12");

iJobTime[JOB_DAY_OF_THE_WEEK] = GetNativeCell(5);
if (!SC_IsDayOfTheWeekValid(iJobTime[JOB_DAY_OF_THE_WEEK]))
return ThrowNativeError(SP_ERROR_NATIVE, "Day of the week value is out of range - Min 0 (Sunday) - Max 6 (Sat)");


Basically everything will give user feedback (Just noticed a spelling mistake too and my OCD wants to release an update "Minumum" but will wait and see how the progression goes with the events module).

@igotfits Everything is ran directly on the server as Bittersweet said, no need to have anything related to using remote console and glad you like the plugin


Been really busy since i got back home last weekend with real life, sorry for the late replies.

peri0dic
02-07-2016, 21:10
Im trying to make this command "!sm_csay Hello" run every 5 minutes im having trouble figuring it out
I want to go every 5 minutes forever.. any help formatting it? I am utterly confused haha thanks :3

Snaggle
02-08-2016, 06:29
I want to go every 5 minutes forever.. any help formatting it? I am utterly confused haha thanks :3

Could this work?
*/5 * * * * "sm_csay @all Hello"

dubbeh
03-18-2016, 04:25
Could this work?
*/5 * * * * "sm_csay @all Hello"

Hey, Sorry I missed this.

The way the plugin is coded right now, it doesn't support that style command syntax - Will have to add an individual job once every 5 minutes for it to function like that.
Hopefully I can get that done for the next update, been quite busy getting Radio finished recently and was away from home for 3 months.

szogun
09-05-2017, 15:41
What do you do wrong, he adds by rcon command

sc_addjob 10 21-23 * * * "exec server.cfg"

logs
sc_addjob 10 21-23 * * * "exec server.cfg"
[SC] Cron job """ added successfully
exec: couldn't exec server.cfg"
L 09/05/2017 - 21:39:48: rcon from "xxx": command "sc_addjob 10 21-23 * * * "exec server.cfg"

next command
sc_printjobs

log
Id Minute Hour DayOfTheMonth Month DayOfTheWeek Job
0 10 21 * * * "
L 09/05/2017 - 21:41:28: rcon from "xxx": command "sc_printjobs "