Ahtenus / minecraft-init

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

CentOS7 #170

Open DenValk opened 9 years ago

DenValk commented 9 years ago

Doesn't work well in CentOS7. Generates PID file but wont launch server on boot. Works fine when started manually (service minecraft start).

shakeyourbunny commented 9 years ago

No wonder, CentOS 7 switched to "the future of init systems" and is not compatible with "old useless System V Init" due to a whole incompatible way of booting the distribution :)

DenValk commented 9 years ago

I actually made work around that I will submit/post when I get home. A couple links have to be changed, but other than that it works just fine.

---- On Tue, 14 Oct 2014 03:21:15 -0700 shakeyourbunny <notifications@github.com> wrote ----

No wonder, CentOS 7 switched to "the future of init systems" and is not compatible with "old useless System V Init". minecraft-init would need a rewrite from scratch and this won't (hopefully) happen. — Reply to this email directly or view it on GitHub.

DenValk commented 9 years ago

So, changes I had to make to get it to run on CentOS7.

In minecraft I changed each occurence of /etc/init.d to $SRVPATH

In config, I added the following lines

Path to Service Location --typically "/etc/init.d"

SRVPATH="/srv/mcsrv"

I created the file minecraft.service in /etc/systemd/system. The file contains:

[Unit] Description=MineCraft Server Requires=network.target After=network.target

[Service] User=mcserver ExecStart=/srv/mcsrv/minecraft start ExecStop=/srv/mcsrv/minecraft stop Type=forking GuessMainPID=true

[Install] WantedBy=multi-user.target

and executed of course ln -s /home/MCUSER/MCPATH/minecraft /srv/mcsrv/minecraft

It seems to be working well.

I may make some more edits and clean things up later.

Leopere commented 9 years ago

Did these changes get accepted? I would love to have this work with systemd I feel like it adds the final missing piece for the uptime puzzle. May I suggest inclusion of the "restart=" directive?

DenValk commented 9 years ago

I didn't. Before I really got into it, I started my Ph.D. program, and I haven't played but a few hours of any game, let alone manage my server since. Feel free to clean it up, give it some polish, and submit it yourself if you like. I like the idea of including the "restart=" directive.