SimpleCronClone
There are two parts to SimpleCronClone: scheduled scripts based on a cron-like syntax, and scripts that are called when certain events occur.
SimpleCronClone
This part of the plugin mimics the behavior of cron (for Windows-Users: Planned Tasks) and allows you to schedule scripts and commands for execution. It uses the awesome cron4j scheduler written by Carlo Pelliccia and it's own very, very, very, very, very basic scripting language.
How does it work? Well, the file plugins/SimpleCronClone/tab.scc is used as crontab-file, but instead of whole commands, it only takes the names of scripts. The tab file is parsed and scheduled, and when according the the cron part, the script is ran.
The CronClone part is to help with automated tasks that every server needs help with. For example:
- sending a message to the console every set amount of time.
- running a series of scripts that are dependent on the server running (eg, backups, off-site backups and more)
- running a series of in-game commands every so often (clearing logs, resetting arenas and much more, depending on your other plugins)
- query OS programs for status or information and use that information inside of the SCC script
EventEngine
New in v1.0, the EventEngine is a extension to the normal SimpleCronClone that calls event scripts (ending in .sce
) when certain events occur.
The idea of this is that now by adding scripts to plugins/SimpleCronClone/tab.sce
you will be able to do certain stats gathering or any other kind of thing based on events that players themselves cause. An example is lets say you have an adventure world, you can set a script to be run saying "do say hey player $1 is now playing in $2 adventure map, go join!" when a world is no longer empty, and when the world is empty again have a script revert it to normal. This is just one of many things that could be done with the EventEngine. See the events page for what events can be scheduled and how.
** Script Format **
See here
** Tab Format **
See here
** Warning about security **
One word of warning: Whatever you'll execute, it will have the same rights as the user from which the server is run. So be careful. Also keep in mind the execution-directory of the script is the server-directory for executables, not the plugin-directory.
Last request: I could really use some kind of "wait" parameter in my .scc execution files, to pause inbetween command lines - for example, this is a much nicer way of doing a scheduled reboot:
@admalledd
I'm perfectly happy being limited to one command per line. Then, if more complex scripting is desired, I can just use the external files as they work currently.
Happy to wait for 1.0 for inline commands, watching for those other two bits to come sooner...
Thanks for being so responsive! Are you by chance interested in helping with some plugin development for our apocalypse server? There are various important plugins whose authors simply never respond, or have abandoned their projects altogether.
We could use another good developer to help with plugins from custom architecture generation to anti-combat logging. Sometimes it's just an update/fix, sometimes a few extra features tacked on. ;-)
@ronfkingswanson
hrm... that would be doable but you would be limited to one command I think. (and this would have to wait till the 1.1 release, don't want to muck up things that I have already tested for the past few days, 1.0 is already taking longer than I thought.)
issue tracker for inline commands in tab.(scc|sce)
PS: thanks for bringing some recommendations to the table! I get a little complacent with how it works since I wrote it, need that kick in the pants every once in a while...
@admalledd
Wonderful!
I don't suppose you might consider allowing for commands to be placed directly in the tab.scc? Rather than having to create, reference, and edit a whole bunch of external files (particlularly when each file only executes one command?). Can get a little tricky keeping track of what's happening at what times...
Might look like this:
0 * * * * hourlystuff.scc
@ronfkingswanson
ah sure. opened two issues for settings and for permissions so that I remember :D
Expect a build with these fixed sometime tomorrow, I have to run to bed, its almost midnight here. (The build will also include our new SimpleCronEvents, which I will write a new documentation page on tomorrow...zzzZzz)
so glad to have a decent cron scheduler, as my last plugin was abandoned (and had no permissions control for its in-game commands)
So I'm happy to see you've blocked the usage of "/simplecronclone" in game (though it would be nice to have permissions support, still better than open to everyone).
My only request would be to have the option of suppressing the console output
every time a script is run. I have multiple scripts, some of them executing every minute or two for server stats output, and it clutters my console to see that simplecronclone line every time a command is fired off.