Plugin to run commands weekly?

Discussion in 'Bukkit Discussion' started by Gunnerrrrr, Dec 27, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Gunnerrrrr

    ZxGuNneR0cKz likes this.
  2. Offline

    mgsolidus

    You can use a cron job to execute a command in screen, assuming you use it. I've not managed it successfully but I know it can be done.
     
  3. Offline

    Gunnerrrrr

    Didn't even think about that, I'l look into it.

    Thanks!
     
  4. Offline

    mgsolidus

    Okay, here's you do it. Create a shell script in your MC directory with these contents,


    Code:
    #!/bin/sh
    screen -x 1052 -X stuff "your command goes here"`printf "\r"`;
    
    We'll assume the file is named command.sh

    Then you'll need to make a cron entry like so,

    Code:
    0 0 * * 6 /path/to/mc/command.sh
    That'll run the script every Saturday.
    "1052" is just my screen ID, you'll have to edit that to your own. Or you can start screen using -S name to give it a unique name.

    Tested on my server and working just fine.
     
    Gunnerrrrr likes this.
  5. Offline

    Gunnerrrrr

    mgsolidus
    What's up with the time though? How does 0 0 * * 6 resemble it to run every Saturday, and what time?
     
  6. Offline

    mgsolidus

    My bad, it should be be * * * * 6
    That'll run the script at any hour and minute on Saturday.
    If you want to be more specific, 10 22 * * 6
    That will run the script at 10:10pm every Saturday. * means any
    Format is <minute> <hour> <day> <month> <weekday>
     
    Gunnerrrrr likes this.
Thread Status:
Not open for further replies.

Share This Page