SourceMod Server Crontab


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

Server Console Commands

  • sc_addjob Minute Hour DayOfTheMonth Month DayOfTheWeek “Cronjob” – Adds a new cronjob that will run at the specified time
  • sc_removejob cronid – Removes a cronjob using the cronid
  • sc_removealljobs – Removes all the current cronjobs
  • sc_printjobs – Prints out all the current cron jobs in the console
  • sc_module_hour_adjust -23/+23 – Adjust the job hour value by -23 or +23 – This is for servers that are outside your local time zone and want jobs to run inside yours

Usage and Examples

All the tasks can be setup inside the sc_jobs.cfg file, or using sc_addjob from the server console. Few examples can be found inside with the config file with descriptions.

Format specification taken from the Cron Wikipedia article.
* * * * * server command to execute
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (0 – 6) (0 to 6 are Sunday to Saturday)
│ │ │ └────────── month (1 – 12)
│ │ └─────────────── day of month (1 – 31)
│ └──────────────────── hour (0 – 23)
└───────────────────────── min (0 – 59)

Example 1 – Say Hello Server – Every minute

sc_addjob * * * * * “say Hello Server”

This would “say Hello Server” – every single minute from the server.
Like you typed in “rcon say Hello Server” – because the input is all wildcards (ignored). So basically the runner thread which checks jobs schedules every single minute would know to ignore all input values and run the task.

Example 2 – Shutdown the server every morning at 5AM

sc_addjob 0 5 * * * “quit”

This would run the “quit” RCON command at 5am every single day – Be careful with this because any jobs you run outside a longer time span would get reset and the server would go back to the basic config which you start up with (autoexec.cfg/server.cfg).

Example 3 – Execute the christmas.cfg on the 1st of December at 12am

sc_addjob 0 0 1 12 * “exec christmas.cfg”

Execute the christmas.cfg on the 1st of December every year – if we added a day of the week to this instead of wildcard. This job would only execute if the 1st of December came on that specific weekday.

Example 4 – Execute an unluckyday.cfg on Friday the 13th at 12am

sc_addjob 0 0 13 * 5 “exec unluckyday.cfg”

Run an unluckyday.cfg on each Friday the 13th – 5 being a Friday with the Day of the Week option. We skip Day of the Month because in this instance it’s unnecessary.


  • sc.smx -> addons\sourcemod\plugins
  • sc_module.smx -> addons\sourcemod\plugins
  • sc_jobs.cfg -> cfg\sourcemod
  • sc_module.cfg -> cfg\sourcemod
  • sc.sp -> addons\sourcemod\scripting
  • sc_module.sp -> addons\sourcemod\scripting
  • -> addons\sourcemod\scripting\include


Download locally from here
SourceMod Thread can be found here


You can help support plugin development and server costs by white listing the website in your Adblock software or sign up for Vultr using my affiliate URL here for $100 credit, available for a limited time (Top 3 rated VPS host with multiple locations), Thanks.


FatallError – getTime idea from his shutdown plugin
Nican – Giving ideas for the module and teaching me the more advanced aspects of SourceMod

Version History

– Recoded the plugin to use new decals
– Crontabs are now based on the official UNIX format – Read up more about them here
– Added checks for a valid number of parameters – To avoid any potential problems

– 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

– Fixed the config file getting ignored for SC Module
– Moved to a global versioning inside the

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

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

– Moved the plugin out of beta
– Big rewrite – now module based
– Wildcard character is now “?”
– New console vars – sc_addjob/sc_removejob/sc_removealljobs/sc_printjobs
– Minutes now support the wildcard option

– Jobs input weekday/hour/minute are now range checked
– The hour option can now use a wildcard “*”

– Renamed the plugin to Basic Server Crontab
– Fixed a bug with parsing the jobs.ini file
– Few more misc changes

– Initial public release

8 thoughts on “SourceMod Server Crontab

    1. dubbeh says:

      You’re welcome – Good to hear you got everything working.

      Feel free to give me a shout if you have any more problems and need help.

  1. Lentomannen says:

    I also get this error when i add job thru console

    ] sc_addjob * * * * * “say Hello Server”
    [SC] sc_addjob – Invalid usage
    [SC] Usage: sc_addjob minute hour day_of_the_month month day_of_the_week “cronjob”

    1. dubbeh says:

      Can’t seem to replicate this issue. Just ran a test and everything was working fine.

      Console Log Snippet:
      sc_addjob * * * * * “say Hello Server”
      [SC] Cron job “say Hello Server” added successfully
      L 01/16/2017 – 16:55:19: [sc_module.smx] Running cron job “sm_hsay This server is running Server Crontab”
      L 01/16/2017 – 16:55:19: [sc_module.smx] Running cron job “say Hello Server”
      L 01/16/2017 – 16:55:19: [basechat.smx] “Console<0>” triggered sm_hsay (text This server is running Server Crontab)
      Console: Hello Server

      Which shows the job was added fine without problems. Which mod was this under and how was you adding the job?

  2. Lentomannen says:

    Hi thanks you so much fpr the quick reåly abd these commands.

    I chamged jobs in the cfg, when the server was running, is there any command to re read the jobs from the cfg file?

    1. dubbeh says:

      Hey. You’re welcome, The jobs config file is parsed when the plugin initially loads.

      If you want to parse the config while the server is running. You’ll have to type this command in the server console:
      “exec sourcemod/sc_jobs.cfg” – This just forces the server to execute a config file and exists amongst most source game mods.

      Don’t worry about the same jobs getting added multiple times with that command – Plugin checks whether a job exists before saving internally.

  3. Lentomannen says:

    Hi. Is there anyway i can “update” the tasks i add withput restarting my server? If i for example have added a new sm_say, i want it to show the new text.

    1. dubbeh says:


      You can type in the console:
      “sc_printjobs” – Prints all the cronjobs with their ID

      Once you’ve found the job you want to modify, type:
      “sc_removejob ID” – ID will be the number from the print jobs command that you want to remove.

      Now you can add the modified job using:
      “sc_addjob” – Using the data from job above with your personal modifications

      Just double check you don’t have it in the sc_jobs.cfg and it won’t overwrite your custom settings.
      Could add “sc_save_jobs” or something along them lines to the next update, that dumps all your current jobs to the config file.

      If you need anymore help, feel free to comment back.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.