Gentoo Archives: gentoo-user

From: Jake Moe <jakesaddress@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Writing Gentoo initscript question
Date: Sat, 05 Mar 2011 22:49:47
Message-Id: 4D72BD95.4040501@gmail.com
1 I'm currently trying to write a simple initscript to run
2 minecraft-server on one of my boxes. I've looked at the ebuild provided
3 via java-overlay, but it turns out it uses baselayout 2, and I'm not
4 ready to go down that upgrade path on this particular box just yet.
5
6 So far, I've managed to get a simple start() function written, which
7 kinda-sorta "works"; it will start the server, but there are two problems:
8
9 1) The "server" was written to stay interactive on a console, so you can
10 manage it from there. As such, the process never exits, so the
11 initscript gets stuck on "starting"
12 2) There is nowhere in the server config file to specify where it writes
13 it's data files. So when I run this from my initscript, it seems to
14 default to the root directory, and I can't figure out how to tell it to
15 use something else as a working directory.
16
17 So far, I've got this:
18
19 depend() {
20 need bootmisc localmount net
21 }
22
23 start() {
24 einfo "Starting Minecraft Server"
25 cd /usr/local/games/minecraft-server
26 start-stop-daemon --start --make-pidfile --pidfile
27 /var/run/minecraft-server.pid \
28 --exec /usr/bin/java -- -Xmx1024M -Xms1024M -jar
29 /usr/local/games/minecraft-server/minecraft_server.jar nogui
30 eend $?
31 }
32
33 Do any of the experts here know a way out of my dilemma?
34
35 Jake Moe

Replies

Subject Author
Re: [gentoo-user] Writing Gentoo initscript question Florian Philipp <lists@×××××××××××.net>