Ahtenus / minecraft-init

Init script for minecraft and bukkit servers
404 stars 125 forks source link

*Feature Request* support with spigot restart command #144

Open soulgriever opened 11 years ago

soulgriever commented 11 years ago

Spigot/mcpc+ has an option to run an automated script to restart the server on the event of a crash or if the "restart" command is given, I would like to know if there is any way to make it compatible with minecraft-init I have tried several things with no sucess

Leopere commented 11 years ago

@soulgriever could you document here what "several things" means? I would consider writing a .sh script that includes the service minecraft stop service minecraft start etc. or some more advanced version of this.

soulgriever commented 11 years ago

I tried writing a sh script that passed the command for it to start the server (ex. /etc/init.d/minecraft start), wrote an sh script that passed the command for it to restart the server (ex. /etc/init.d/minecraft restart) I honestly dont rember what else I did its been a bit

Leopere commented 11 years ago

OK fair enough have you tried service minecraft restart I've not tried this at all myself I'm also curious as to what works and may not.

queketth commented 10 years ago

Does this script work with spigot servers ?

Leopere commented 10 years ago

It will if you add it to the config just replace bukkit.jar with spigot.jar

alfonsojon commented 10 years ago

I believe the OP is looking for native Spigot integration so that when Spigot detects it has crashed, it can use this script to automatically restart it. I will be working on this.

Leopere commented 10 years ago

That would be lovely I would be very happy with this concept. Would you also be able to make an if-down-up kind of thing? That would be super phenomenal.

alfonsojon commented 10 years ago

It would be. I'm working on it here: https://github.com/alfonsojon/minecraft-init

soulgriever commented 10 years ago

Let me know when its done. Might be adding minecraft-init back to my server. Simple but yet the best ive used yet. Also might want to state mcpc+ as well if its supported (spigot is built into mcpc+)

soulgriever commented 10 years ago

if/when this functionality is incorporated how would it be executed? if the server crashes spigot detects it has crashed and attempts to run a script would I just make a shell script with "/etc/init.d/minecraft restart" but the problem is the execution spigot starts the new server before exiting the old one, so for this to work you would have to have some sort of sleep command

Leopere commented 10 years ago

Its already incorporated you can view it on @alfonsojon's github repo he linked. You don't have to wait for it to be accepted.

soulgriever commented 10 years ago

@chamunks It is not incorperated all he did was add an update function for spigot, this has nothing to do with the restart support he was talking about, and as he said above he "would be working on it" never said it was done

Leopere commented 10 years ago

@soulgriever If no one else does it I'll have someone do it by tomorrow because I'm tired of not having this feature myself.

soulgriever commented 10 years ago

to make it work simply set your start.sh to the following

!/bin/bash

screen -X -S minecraft quit screen -S Temp -d -m /etc/init.d/minecraft restart

that took way to long to figure out

Leopere commented 10 years ago

@soulgriever Not sure if this is exactly what you're looking for but with this PR https://github.com/Ahtenus/minecraft-init/pull/160 you can run a cronjob every X amount of time that will autoboot your server if its dead. So it may not be start.sh support but you might even be able to add a start.sh that supports this in some way. Just grab the init off of my repo. It also includes the spigot.jar support etc.

Leopere commented 10 years ago

Theres some bugs with my pull request don't use it just yet.

alfonsojon commented 9 years ago

@soulgriever @chamunks My fork is now much more compatible with Bukkit and Spigot. I'm currently looking for Spigot documentation on this, as it doesn't seem especially clear as to how this would work.