Permalink
Browse files

rework the initscript, add a conf file

  • Loading branch information...
hasufell
hasufell committed Nov 3, 2012
1 parent bf20ed7 commit 544bd9c276f45353dfe30ce050e2ba32c5b93c7f
@@ -0,0 +1,16 @@
+# /etc/conf.d/minetest-server: config file for /etc/init.d/minetest-server
+
+# user
+USER="minetest"
+
+# group
+GROUP="@GROUP@"
+
+# pidfile
+PIDFILE="/var/run/minetest.pid"
+
+# executable
+MINETESTBIN="@BINDIR@/minetestserver"
+
+# additional arguments for the server
+ARGS="--logfile /var/lib/minetest/minetest-server.log"
@@ -1,26 +0,0 @@
-#!/sbin/runscript
-
-depend() {
- need net
- provide mineserver
-}
-
-start() {
- start-stop-daemon \
- --start \
- --user minetest \
- --group minetest \
- --make-pidfile \
- --background \
- --stdout /var/lib/minetest/server.log \
- --exec /usr/games/bin/minetestserver \
- --pidfile /var/run/minetest.pid
-}
-
-stop() {
- start-stop-daemon \
- --stop \
- --exec /usr/games/bin/minetestserver \
- --pidfile /var/run/minetest.pid
-}
-
@@ -0,0 +1,36 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+description="Minetest dedicated server"
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "starting server"
+ start-stop-daemon \
+ --start \
+ --quiet \
+ --make-pidfile \
+ --pidfile "${PIDFILE}" \
+ --background \
+ --user ${USER} \
+ --group ${GROUP} \
+ --exec "${MINETESTBIN}" -- ${ARGS}
+
+ eend $?
+}
+
+stop() {
+ ebegin "stopping server"
+ start-stop-daemon \
+ --stop \
+ --signal 15 \
+ --quiet \
+ --pidfile "${PIDFILE}"
+
+ eend $?
+}

0 comments on commit 544bd9c

Please sign in to comment.