restart script not working.

Discussion in 'Spigot Help' started by InuYasha86000, May 12, 2015.

  1. I have read around and tried many a different method to get my startup scripts to work but it does not work. at first I tried using it as an initial startup script meaning I thought all I had to type on first boot (after changing to the minecraft folder) was or ./ to get it to startup the server, but that doesn't work at all.
    I have read that the restart is in the spigot.yml file, here is both my file and spigot.yml files:
    Code (Text):

    java -Xms1024M -Xmx4096M -XX:MaxPermSize=128M -jar spigot.jar
    and spigot.yml:
    Code (Text):
    # This is the main configuration file for Spigot.
    # As you can see, there's tons to configure. Some options may impact gameplay, so use
    # with caution, and make sure you know what each option does before configuring.
    # For a reference for any variable inside this file, check out the Spigot wiki at
    # If you need help with the configuration or have any questions related to Spigot,
    # join us at the IRC or drop by our forums and leave a post.
    # IRC: #spigot @ ( )
    # Forums:

    config-version: 8
      save-user-cache-on-stop-only: false
      bungeecord: false
      late-bind: false
      sample-count: 12
      player-shuffle: 0
      filter-creative-items: true
      user-cache-size: 1000
      int-cache-limit: 1024
      moved-wrongly-threshold: 0.0625
      moved-too-quickly-threshold: 100.0
      timeout-time: 60
      restart-on-crash: true
      netty-threads: 4
          max: 2048.0
          max: 2048.0
          max: 2048.0
      debug: false
      global-api-cache: false
      tab-complete: 0
      log: true
      - /skill
      silent-commandblock-console: false
      - setblock
      - summon
      - testforblock
      - tellraw
      whitelist: Server Under Maintnance, Authorized Members Only!
      unknown-command: What command is that? Try /Help
      server-full: Pool is Full!
      outdated-client: Outdated client! Please use 1.8 or higher
      outdated-server: Outdated server! I'm still on {0}
      restart: Windows Is Restarting........
      disable-saving: false
      forced-stats: {}
        verbose: true
        nerf-spawner-mobs: false
          cactus-modifier: 100
          cane-modifier: 100
          melon-modifier: 100
          mushroom-modifier: 100
          pumpkin-modifier: 100
          sapling-modifier: 100
          wheat-modifier: 100
          animals: 32
          monsters: 32
          misc: 16
          players: 48
          animals: 48
          monsters: 48
          misc: 32
          other: 64
          hopper-transfer: 8
          hopper-check: 8
        hopper-amount: 1
        random-light-updates: false
        save-structure-info: true
        max-bulk-chunks: 5
        max-entity-collisions: 8
        dragon-death-sound-radius: 0
        seed-village: 10387312
        seed-feature: 14357617
          walk-exhaustion: 0.2
          sprint-exhaustion: 0.8
          combat-exhaustion: 0.3
          regen-exhaustion: 3.0
        max-tnt-per-tick: 100
          tile: 50
          entity: 50
        mob-spawn-range: 4
          enabled: false
          engine-mode: 1
          - 14
          - 15
          - 16
          - 21
          - 48
          - 49
          - 54
          - 56
          - 73
          - 74
          - 82
          - 129
          - 130
          - 1
          - 5
        item-despawn-rate: 6000
          item: 2.5
          exp: 3.0
        arrow-despawn-rate: 1200
        enable-zombie-pigmen-portal-spawns: true
        wither-spawn-sound-radius: 0
        view-distance: 10
        hanging-tick-frequency: 100
        zombie-aggressive-towards-villager: true
        chunks-per-tick: 650
        clear-tick-list: false
        hopper-alt-ticking: false
    Am I just crazy or am I as least somewhat on the right track?
  2. Does the console display that the script isn't found?
  4. when I try starting it the first time by typing "" it just says " command not found", and if I try starting it using "./" it comes up with "bash: ./ /bin/bash^M: bad interpreter: No such file or directory", am I missing a program to use .sh files or is it something else?
    #4 InuYasha86000, May 13, 2015
    Last edited: May 14, 2015
  5. anyone got any ides why it's not working?
  6. What is your os?
  7. If it says file not found try changing to the Directory where the file is. There is also a way to make a symbolic link to the start script but I will let Google handle that. (Search Google making symbolic link) I have also changed mine from bash to this, Can't remember why but I'm sure I did it for a reason...
    Code (Text):
  8. yeah my main PC is windows 7 and the server is Ubuntu server 14.04
  9. Yeah, so either follow what I quoted, or recreate the script from your server.
    • Agree Agree x 1
  10. dos2unix worked perfectly, thank you so much. I would have thought the code would have worked regardless but I was wrong, at least the dos2unix protocol is easy to install and easy to use.

    [EDIT] the script works perfectly however I tried restart in the server using /restart and it just shut down the server and did not restart, I did try adding the ./ in the Spigot.yml file and it didn't work, any suggestions?
    #12 InuYasha86000, May 16, 2015
    Last edited: May 16, 2015
  11. I couldnt help you with the restart command, as I don't use it.

    Instead, I use something similar to this as my start script:
    Code (Text):
    # /bin/sh

    while true
    java -Xms___M -XmM____M -jar spigot.jar
    echo Server stopped. Restarting in 5 seconds.
    echo Use "Ctrl + C" to cancel restart.
    sleep 5
    Basically, when you stop your server, it will automatically rerun the script.

    EDIT: Forgot the shebang in the script
    • Agree Agree x 2
  12. that would be a problem though as when I issue the /stop command I want it to completely stop the server and not restart so if I need to add or replace a plugin I can stop the server properly and such. I do appreciate the help though and thank you again for helping getting the script working at least.
  13. You can cancel the startup by doing "Ctrl+C", whilst it is sleeping for the 5 seconds. (As long as you're in the console.

    All good. Good luck.
    • Agree Agree x 1
  14. Hey guys, if you having trouble using the restart script, you can use this method:

    First, rename your .bat file to "Run.bat"
    Then, in the spigot.yml:

    Set the "restart-script" to "Run.bat"

    Run the server and try the "/restart"

    command. If the server failed to restart, there might be a misspelled things...

    All done. I hope it works for you guys
    • Like Like x 1
    • Optimistic Optimistic x 1
  15. 4 years old but this is still good info, does this work in ubuntu as well or just a windows thing?

    Also, is there a restart script that works for forge 1.12.2 as I also have a forge server.
  16. Just have the script end with “sh” so it starts back up
  17. Hello, I just want to help, I post the solution I have found myself, because Internet doesn't give the best solution, spigot.yml execute with bash interpreter, and it has the time to execute only the first line, so you need to create the screen, go the directory and launch the jar in the same line (It took 3 days to me to find this solution).
    This is my code for a simple start with the .sh in the same folder of my jar, my server's name is "test":
    Code (Text):

    screen -dmS test bash -c 'cd /home/minecraft/serveurs/test/ && exec -a "test" java -Xms1G -Xmx2G -jar Spigot.jar'
  18. This is not just a Windows thing.
    Minecraft runs on Java, hence any '.sh' commands are run in Java.