[ADMN] SimpleCronClone v0.5, A cron-like scheduling system [1337]

Discussion in 'Inactive/Unsupported Plugins' started by Bobby_Bonsai, Feb 27, 2011.

  1. Offline


    SimpleCronClone - A cron like system
    Version: v0.5 [1337]

    This 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 (three commands, actually). I needed to pack the two jars together, otherwise Bukkit would have died.

    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 in the same directory. There are three commands for scc-scripts: do, exec and execWait. do will send the line as command to the server console. exec will execute the line as system command. execWait will also execute the line as system command, but will wait for it to finish (and store the result for later use). With the placeholder $? you can get the output of the last execWait command. Every line that starts with # will be ignored, if you use # in a line, everything after it will be ignored.

    If you want to know what all the asterisks mean, please have a look at the examples at crons Wikipedia page.

    This plugin is lazy, you'll have to create all files yourself.

    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, not the plugin-directory.

    Please be aware that I'm not actively maintaining this plugin. I might do some coding from time to time, but do not expect that I keep up with every Bukkit-Release. Also if you want to report errors or suggest new features, please do that on GitHub and do not expect this thread to be updated.


    Example tab-file
    Example script

    Download (Latest Version)
    Niles and maxexcloo like this.
  2. Offline


    Hello Bobby_Bonsai,

    Oh, this is great. I'll look into it when I have time this week. Holiday's over so that means back to school. Kind of busy this week, but I'll test it out and give feedback eventually.
    Thanks for making this,

  3. Offline


    this would go nicely if we had a way to pause the server entirely. backups while players are building, well, sufficed to say, they can go badly.
  4. Offline


    @kronflux: save-off should stop all disk-writing completely.
  5. Offline


    Thankyou for making this, it's made some things so much easier!
    I started using it instead of my system's crontab, which complained if the server wasn't running.
    Firstly just for backups, but now it also kicks off scripts to maintain my server's web page (which runs on Dynmap's internal web server) and generally keep things tidy.

    It took a while to get it right - you have to create a SimpleCronClone folder in /plugins and put all the .scc files in there, and I found it best to specify all the paths to the files referenced in the .scc scripts.
  6. Offline


    @souterain: Glad that I could help. :)
  7. Offline


    Oh my god, I only just noticed that I haven't thanked you yet for creating this. I've been using it for a while and it's great. Keep up the good work mate!
  8. Offline


    @Fyridor: You're very welcome. :)
  9. Offline


    is there a way to run a script every xth minute/hour etc ... ?
    in the wiki for cron was stated that you could use */2 for every 2 hours.
    but that doesn't work here :(
    a workaround is to type a 24hour schedule ... but I would prefer the 'wiki' method
  10. Offline


    @saturnine_nl: Works fine for me and is also documented at the cron4j documentation. Could you please post the whole line you're using?
  11. Offline


    I had to make sure it was my mistake and not some missing feature :D ...
    I'm sure it's just a typo or some stupidity i did ... I'm gonna play a little bit
    with it and i'll get it working ;)

    nice plugin by the way. It makes the imposible posible, just write a few lines and off you go :)
  12. Offline


    @saturnine_nl: If you still have problems with it, just post the line and/or the tab.scc. If there are any error messages, please post them, too.

    And thanks, I'm glad you like it. :)
  13. Offline


    Very nice, now I don't need sh scripts anymore... oh wait.
  14. Offline


    @Nijikokun: I know what you mean, but it has one advantage over a simple shell script: Easy interaction with the server. I mean I can easily interact with the server via a screen session...but that's not the easiest thing to set up (and as far as I know pretty close to impossible on non Unix systems).
  15. Offline


    When you are entering a time of day, you would enter it in 24 H time right?
  16. Offline


    @WindedDragon: Yes.
  17. Offline


    I love this Plugin, thank you!
    Is it possible to grep the Count of OnlinePlayers, list and such things? (i want to insert the value into a mysql db)

    Is there any way to Broadcast Messages without [SERVER] with own colors?
  18. Offline


    Update for 617?
  19. Offline


    @qrux: 0.2 is compatible to 670 without any modifications. Do you get a certain error message?

    @MediaMemphis: Glad to hear that. :) And no, I don't have support to execute bukkit functions yet. I've already thought about calling these via reflection or something similar, but couldn't decide yet what to do.
  20. Offline


    Thank you!

    This doesn't seem to work (it skips the tar commands):
    # Backup the world and server.
    do say Server backup started!
    do save-all
    do save-off
    #execWait backup.sh
    execWait bash -c 'tar -zcvf ~/server/backups/server/$(date "+%d-%m-%Y_%H:%M:%S").tar.gz ~/server/* --exclude "~/server/backups/*" --exclude "~/server/world/*" --exclude "~/server/server.l*" --exclude "~/server/logs/worldedit/worldedit.log.*" --exclude "~/server/plugins/CommandBook/bans.*" --exclude "~/server/plugins/dynmap/web/tiles/*"'
    execWair bash -c 'tar -zcvf ~/server/backups/world/$(date "+%d-%m-%Y_%H:%M:%S").tar.gz ~/server/world/*'
    do save-on
    do say Server backup finished!
    Running the backup.sh file didn't either, even with full paths...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 10, 2016
  21. Offline


    @maxexcloo: Neat.
    I can't get anything with bash -c to work either. But extracting these two lines into a script and executing that one should work:

    execWait yourScriptHere.sh
    Please make sure that the executable bit is set and keep in mind that the working directory for executing commands is the server directory. I'll investigate the issue with bash -c, this is odd because it should work without any problems, and every other command is working, too. I can only imagine that it gets executed in a completely different context.

    Edit: Found it. As it seems exec is not working together with that syntax. I'll see if I can get a parser or something going to split commands up and pass them correctly into the system. A workaround is to pack those into a script.

    @maxexcloo: After some more digging, I was able to fix the problem. Big thanks to Tim Pietzcker for his awesome RegEx which made this easily possible.

    Please try v0.3, it should work with that version.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 10, 2016
  22. Offline


    Thanks! I never knew the working directory...
    Great plugin BTW, really solid :)
  23. Offline

    John McFo


    I'm sorry to inform you, that recent CB updates (#685 in particular) broke your plugin:

    11:29:00 [INFO] SimpleCronClone: Executing: plugins/SimpleCronClone/saveall.scc
    11:29:00 [WARNING] Unexpected exception while parsing console command
    org.bukkit.command.CommandException: Unhandled exception executing command 'cron_exec' in plugin SimpleCronClone v0.3
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:80)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:247)
            at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:394)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:379)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:285)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    Caused by: java.lang.NoSuchFieldError: g
            at org.bonsaimind.bukkitplugins.SimpleCronCloneCommandHelper.queueConsoleCommand(SimpleCronCloneCommandHelper.java:49)
            at org.bonsaimind.bukkitplugins.SimpleCronCloneHelper.parseScriptLine(SimpleCronCloneHelper.java:172)
            at org.bonsaimind.bukkitplugins.SimpleCronCloneHelper.executeScript(SimpleCronCloneHelper.java:148)
            at org.bonsaimind.bukkitplugins.SimpleCronClone$3.onCommand(SimpleCronClone.java:113)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
            ... 6 more
    However, I did some research to pinpoint the problem and found this API updates in the recent CB code, on which your plugin depends:

    Looks like
    if ((!ms.g) && (MinecraftServer.a(ms))) {
    ms.a(cmd, ms);
    in SimpleCronCloneCommandHelper.java should be replaced by
    if ((!ms.isStopped) && (MinecraftServer.log(ms))) {
    ms.issueCommand(cmd, ms);
    Beware, there might be more changes necessary. The above suggestions are only, what I could find by hand, looking at the exception I got. I didn't use nor test other commands like exec and execWait.

    Would you please update SCC?
    Greetings, McFo

    btw: Great plugin! [diamond]
  24. Offline


    @maxexcloo: Thank you. :)

    @John McFo: Never be sorry to report bugs or issues. Software development, especially FLOSS, lives from feedback. Also big thanks for the digging you did, it was very helpful. As it turns out, a in this case is not the logger, but the method isRunning.

    if ((!ms.isStopped) && (MinecraftServer.isRunning(ms))) {
    	ms.issueCommand(cmd, ms);
    I've prepared an update, but will only finalize it if the RB is out. For the mean time, you can grab version 0.3.714 directly from repo.

    @JonasQ: Thanks for reporting.
  25. Offline


    Still getting the same error, sadly. :<

    EDIT: Nevermind, I'm just a royal idiot. I uploaded it to the wrong directory. It works fine. Thank-you!
  26. Offline

    John McFo

    This is my style of being polite... ;)

    I examined the code using only Firefox, so my options of deobfuscating the code were limited... :)

    Thanks for the direct link! Have another [diamond]!

    Greetings, McFo
  27. Offline


    Really love this plugin! Thanks so much! but its not working for me now. Let me know if you need more info...
    this is the console error when it attempts to run...

    CraftBukkit 733

    0:00:00 [SEVERE] java.lang.NoSuchFieldError: g
    20:00:00 [SEVERE] at org.bonsaimind.bukkitplugins.SimpleCronCloneCommandHelper.queueConsoleCommand(SimpleCronCloneCommandHelper.java:49)
    20:00:00 [SEVERE] at org.bonsaimind.bukkitplugins.SimpleCronCloneHelper.parseScriptLine(SimpleCronCloneHelper.java:172)
    20:00:00 [SEVERE] at org.bonsaimind.bukkitplugins.SimpleCronCloneHelper.executeScript(SimpleCronCloneHelper.java:148)
    20:00:00 [SEVERE] at org.bonsaimind.bukkitplugins.SimpleCronCloneHelper$1.run(SimpleCronCloneHelper.java:120)
    20:00:00 [SEVERE] at it.sauronsoftware.cron4j.RunnableTask.execute(Unknown Source)
    20:00:00 [SEVERE] at it.sauronsoftware.cron4j.TaskExecutor$Runner.run(Unknown Source)
    20:00:00 [SEVERE] at java.lang.Thread.run(Thread.java:636)

  28. Offline


    I've finalized the fixes for 733, version 0.4 is out.

    @avoidedlife: Thanks for reporting, I fixed this in...somekind of beta build already on sunday. v0.4 does include that fix.

    @John McFo: Oh thank you, I was running short on Diamonds. :D
  29. Offline


    Is it possible to use this to execute the command '/permissions -reload all' to reload the Permissions file?
    Using 'do permissions -reload all' does not seem to be doing it.
  30. Offline


    The do should be supporting sending other plugins commands as long as they're accepting commands from the server console. Do you get an error?

Share This Page