Description:
This plugin allows you to create cronjobs.
With cronjobs you can execute commands on time intervals or events / game events.
For time intervals the following intervals are possible: seconds, minutes, hours, days, months, day of week
For events the following events are possible: plugin_start, plugin_end, map_start, map_end and every event available in the current game (
see here)
The syntax is similarly to the original cronjob syntax of Unix and just as easy to create!
A cronjob can execute one of three different command types:
- Server console commands
Execute commands on the server console
- System commands
Execute commands on the shell with the system2 extension
- Player commands
Players on the server will execute a command
Note: Cronjobs will not be executed if your server is hibernating
How to add cronjobs
Taken from "cfg/cronjobs.txt":
Code:
// * * * * * * <typ> <command>
// - - - - - - - -
// ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦
// ¦ ¦ ¦ ¦ ¦ ¦ ¦ +-- The command to execute
// ¦ ¦ ¦ ¦ ¦ ¦ +-------- Available types are: console (execute server command), system (execute system command with system2 extension), player (execute on player console)
// ¦ ¦ ¦ ¦ ¦ +---------- Weekday (0-7, Sunday is 0 or 7)
// ¦ ¦ ¦ ¦ +------------ Month (1-12)
// ¦ ¦ ¦ +-------------- Day (1-31)
// ¦ ¦ +---------------- Hour (0-23)
// ¦ +------------------ Minute (0-59)
// +-------------------- Seconds (0-59) - Optional, zero if not given
//
// Allowed syntax:
// * = All, wildcard
// */x = Every x sec/min/hour/day/month/weekday
// x-y = From x to y
// x,y,z = On x, y and z
//
// Examples:
//
// Loads a plugin on every 15. of the month and unloads it on the 16. again
// 0 0 15 * * console sm plugins load myplugin
// 0 0 16 * * console sm plugins unload myplugin
//
// Makes a backup of the server every three hours
// * */3 * * * system tar zcvf backup.tar.gz "/home/user/server"
//
// Every player say: Why am i writing? At 15.20, 15.40, 16.20, 16.40, 17.20, 17.40, 20.20 and 20.40
// 20,40 15-17,20 * * player say "Why am i writing ?"
//
// More examples here: http://www.thesitewizard.com/general/set-cron-job.shtml
//
// OR:
//
// @<special> <typ> <command>
// - - -
// ¦ ¦ ¦
// ¦ ¦ +-- The command to execute.
// ¦ +-------- Available types are: console (execute server command), system (execute system command with system2 extension), player (execute on player console)
// +------------------- The special time to execute the command at. Has to start with a @ following the special
//
// Allowed specials: plugin_start, plugin_end, map_start, map_end and every event available in the current game ( see https://wiki.alliedmods.net/Game_Events_(Source) )!
//
// So for example this is valid:
// @player_death player say "Oh! Someone died!"
//
// Just write your Cronjobs below this Line!
How to install / use
Just download the
cronjobs.zip, extract it and put the
cfg and
addons folder to the gamdir of your server.
Add your cronjobs to the
cfg/cronjobs.txt and enable / disable logging in the
cfg/sourcemod/plugin.cronjobs.cfg.
Restart your server, change your map or load it with
sm plugins load cronjobs.
To use system commands you need the
System2 extension!
To enable auto updating you need the
Updater plugin!
You can reload the cronjobs from the
cronjobs.txt file with the
cronjobs_reload server command.
Changelog
- 2.0:
- Added seconds to time interval
- Added execution on events
- Added possibility for updating
- Add support for any whitespace
- No limit for amount of cronjobs
- Fixed some bugs
- Ported to new sourcemod syntax
- Moved convar config file to cfg/sourcemod/plugin.cronjobs.cfg
- Updated for current System2 API
- 1.2:
- Updated for current System2 API
- 1.1:
- Fixed a bug, so that 00 didn't work
- 1.0:
Have fun and report any error!