Skip to content

Instantly share code, notes, and snippets.

@ekarulf
Created September 17, 2010 15:31
Show Gist options
  • Save ekarulf/584396 to your computer and use it in GitHub Desktop.
Save ekarulf/584396 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# PROVIDE: minecraft
# REQUIRE: DAEMON
#
# Add the following lines to /etc/rc.conf to run minecraft:
#
# minecraft_enable (bool): Set it to "YES" to enable minecraft.
# Default is "NO".
# minecraft_java_flags (flags): Set flags here. More options in java(1)
# Default is "-Xmx2048M -Xms2048M".
# minecraft_chdir (path): Set minecraft path here.
# Default is "/usr/local/minecraft".
# minecraft_user (user): Set user to run minecraft.
# Default is "nobody".
#
. /etc/rc.subr
name="minecraft"
rcvar=${name}_enable
pidfile="/var/run/minecraft.pid"
procname="/usr/local/jdk1.6.0/bin/java"
load_rc_config ${name}
: ${minecraft_enable="NO"}
: ${minecraft_user="nobody"}
: ${minecraft_chdir="/usr/local/minecraft"}
: ${minecraft_java_flags="-Xmx2048M -Xms2048M"}
command=/usr/sbin/daemon
command_args="-fp ${pidfile} /usr/local/bin/java ${minecraft_java_flags} -jar minecraft_server.jar"
run_rc_command "$1"
@ekarulf
Copy link
Author

ekarulf commented Sep 17, 2010

rc script for FreeBSD (and probably Net and Open) to run minecraft server. Still needs some cleanup wrt procname and java variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment