Start.sh 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 start.sh or ./start.sh 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 start.sh file and spigot.yml files:

    start.sh:
    Code (Text):
    #!/bin/bash

    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
    # http://www.spigotmc.org/wiki/spigot-configuration/
    #
    # 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 @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )
    # Forums: http://www.spigotmc.org/

    config-version: 8
    settings:
      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
      restart-script: start.sh
      netty-threads: 4
      attribute:
        maxHealth:
          max: 2048.0
        movementSpeed:
          max: 2048.0
        attackDamage:
          max: 2048.0
      debug: false
      global-api-cache: false
    commands:
      tab-complete: 0
      log: true
      spam-exclusions:
      - /skill
      silent-commandblock-console: false
      replace-commands:
      - setblock
      - summon
      - testforblock
      - tellraw
    messages:
      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........
    stats:
      disable-saving: false
      forced-stats: {}
    world-settings:
      default:
        verbose: true
        nerf-spawner-mobs: false
        growth:
          cactus-modifier: 100
          cane-modifier: 100
          melon-modifier: 100
          mushroom-modifier: 100
          pumpkin-modifier: 100
          sapling-modifier: 100
          wheat-modifier: 100
        entity-activation-range:
          animals: 32
          monsters: 32
          misc: 16
        entity-tracking-range:
          players: 48
          animals: 48
          monsters: 48
          misc: 32
          other: 64
        ticks-per:
          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
        hunger:
          walk-exhaustion: 0.2
          sprint-exhaustion: 0.8
          combat-exhaustion: 0.3
          regen-exhaustion: 3.0
        max-tnt-per-tick: 100
        max-tick-time:
          tile: 50
          entity: 50
        mob-spawn-range: 4
        anti-xray:
          enabled: false
          engine-mode: 1
          hide-blocks:
          - 14
          - 15
          - 16
          - 21
          - 48
          - 49
          - 54
          - 56
          - 73
          - 74
          - 82
          - 129
          - 130
          replace-blocks:
          - 1
          - 5
        item-despawn-rate: 6000
        merge-radius:
          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?
     
  3.  
  4. when I try starting it the first time by typing "start.sh" it just says "start.sh: command not found", and if I try starting it using "./start.sh" it comes up with "bash: ./start.sh: /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):
    #!/bin/sh
     
  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 ./start.sh 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
    do
    java -Xms___M -XmM____M -jar spigot.jar
    echo Server stopped. Restarting in 5 seconds.
    echo Use "Ctrl + C" to cancel restart.
    sleep 5
    done
    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 Start.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):
    #!/bin/bash

    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.