Use a flag file #1


  • Enhancment
  • Accepted
Open
Assigned to _ForgeUser7497922
  • PascalFairchild created this issue May 10, 2012

    Your plugin could create an empty file that can be tested against in the batch/shell script to determine if it should restart the server, eliminating the need to issue a break to stop the script loop.

    During your on enable, check if the flag file exists from a previous restart.  If so delete the file.

    When the schedule time to restart the server is reached, create the flag file and stop the server.

    If a stop command is issued to the server, your plugin should just shutdown normally without creating the file.

    The batch/shell script can use an if statement to test if the file exists.  If the file exists it loops, if not it exits.

    For Batch something like
    :DoRestart
      Java –jar craftbukkit.jar
    IF EXIST C:\Bukkit\restart.flag GOTO DoRestart

    For Bash
    while [ -f /bukkit/restart.flag ] ;
    do
      java –jar craftbukkit.jar
    done

    or for bash you could use an infinite loop with an if statement that calls the break command.

  • PascalFairchild added the tags New Enhancment May 10, 2012
  • _ForgeUser7497922 posted a comment Jun 16, 2012

    I like the idea, and will most likely include it in the next update, thanks


    Edited Jun 16, 2012
  • _ForgeUser7497922 removed a tag New Jun 16, 2012
  • _ForgeUser7497922 added a tag Accepted Jun 16, 2012

To post a comment, please login or register a new account.