Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Server & Community Management' started by AgentLV, Apr 26, 2015.
Ok, what does it do?
Thx, now can anyone help me?
I wish I could , unfortunately I can just guess.
The script runs well on /restart, but does not on a crash. So it seems like Spigot is unable to run the script when needed. Do you have some console output of a crash?
Can someone maybe tell me how to kill a server process in a script?
Any serious answers?
Well how do you kill your process without a script? Use the same commands.
I don't know which process you want to kill but my guess is the java process of the Minecraft server.
Identify the PID by using ps and filter the output with awk, sed or any other tools you like and put it into a variable like $pid
Then kill $pid.
If the server process hung up you may need to use kill -9 to send SIGKILL but there WILL be data loss.
The more elegant way would be to send the stop signal to your screen session. Something like
screen -S minecraft -p minecraft -X stuff "stop"`echo -ne '\015'`
so, I know i'm necroing. Kinda. It's hard to necro an unresolved topic though. I've looked everywhere for a script to put in my start.sh file that would restart the server when it's crashed. And I think he's looking for the same thing. Giving that the original author still owns a server, I would like to continue this, mainly for me, obviously (because I would guess he figured it out, or doesn't own server any more). I use spigot, at this point 1.10 (I think he was using 1.8 when he wrote this. wow. I have in my spigot.yml file:
So, when writing my restart script (i know nothing about this, only recently started learning java) it looks like this.
java -jar Spigot.jar
But i don't think that's right. anyone seeing something new since the last post? I know that this would help maannnyy people, as I can't find crap online. A year and half later, and still nothing online about this same issue. someone needs to do a really good tutorial video on it. Or link me to one that I may have missed. Thank you everyone!
That is correct
java -jar Spigot.jar
So, I put this, and only this in my start.sh file. Then I set my start folder (in spigot.yml) to start.sh. and this should restart the server when it crashes?
Yes and Yes but you should really use a webpanel like MultiCraft to reboot on a serious error.
Well, I use server.pro. I just need something that will restart my server in any case that it goes down, without me pressing "stop". i'm in the navy, and I deploy this week, so I want the people who play on there to not worry about it coming back up, or me paying for a dead server while i'm gone. Any suggestions?
hmm I have never used server.pro myself but your there might be a option in the cpanel to reboot the server when it crashes. But using this
java -jar Spigot.jar
it will just loop constantly and keep trying to start the server if the Spigot.jar stops but if the error is happening when your server is starting it will not come backup it will just be in a infinite loop. You should have a staff member that has cpanel access so they can fix these errors if one should occur. Also start your server with start.sh which should contain the script above you can test this by typing /stop in-game or in console and the server should start up again.
Great advise. it still doesn't work for me though. i've emailed the server.pro service team, hope they can help. if I find out anything, I'll be sure to update this forum, because it is still a very wide, an common problem with new server owners. Thank you!
Just this :
screen -dmS survie java -Xmx8G -Xmx8G -jar spigot_server.jar nogui
And change "survie" by the name of your server and 8G bay what you want, 2G - 5G .... its the RAM.
And try a restart of your server.
From what I have read he does not have ssh access to the server
it does not need ssh access only to this single control line in the file start.sh
i know the post is old but haven't found a fix posted any where and its allot simpler then you might think ..
just tell it to sleep for a few seconds giving spigot time to restart before the screen closes.. DONE!
here is my setup:
screen -dmS minecraft ~/minecraft/spigot/./serverstart.sh
java -Xmx1024M -Xms1024M -jar spigot-1.12.2.jar