AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Full Cronjob Plugin [Execute commands on time intervals / game events] (https://forums.alliedmods.net/showthread.php?t=205962)

dordnung 01-16-2013 20:59

[ANY] Full Cronjob Plugin [Execute commands on time intervals / game events]
 
8 Attachment(s)
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:
  1. Server console commands
    Execute commands on the server console
  2. System commands
    Execute commands on the shell with the system2 extension
  3. 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:
    • First Release

Have fun and report any error!

Root_ 01-17-2013 08:27

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
Nice one

dordnung 02-06-2013 08:17

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
Update



Code:

1.1
    -Fixed a bug, so that 00 didn't work


Snaggle 02-06-2013 08:57

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
Thanks! I've been using this plugin in place of an older one and it's working perfectly. Appreciate the work.

sipster19 02-06-2013 23:55

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
What's the difference between your plugin and the Server Crontab plugin?

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

dordnung 02-07-2013 04:02

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
1. The Syntax is similarly to the original cronjob syntax of Unix

2. you have More options how to set up your cronjob (20,40 15-17,20 */2 * ). The crontab plugin only have for each option one number

3. You can execute console, player and system commands

Baron Rojo 02-13-2013 00:29

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
Hi nice plugin did it support map events and map timer? If not could you add this feature?
Thx

AlfredSpain 02-16-2013 15:18

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
good work!

working on my server :D

M@ME 03-03-2013 20:33

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
Is there a way for me to tell the script to change the name of my mapcycle.txt every day at 5pm?

dordnung 03-03-2013 22:09

Re: [ANY] Full Cronjob Plugin [Execute commands on time intervals]
 
Yes this should be possible with the System 2 Exension

Add as a cronjob:

0 17 * * * system mv <gamedir>/mapcycle.txt <gamedir>/<newname>.txt

Replace <gamedir> with your gamedir, like cstrike, or tf or dod.
Replace <newname> with the name to replace to.

Give me a feedback whether it's working.


All times are GMT -4. The time now is 18:57.

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