Tutorials/OpenBSD startup script

Installation
$ sudo pkg_add jdk minecraft
 * Install the Java developer kit and the minecraft installer script

Run minecraft and follow what it tells you to do via terminal, then run minecraft again to start Minecraft. The setup script will only run the first run after installation.

Startup Script

 * create a new startup script, in `/etc/rc.d` named `minecraft`
 * place the following within the script, set it as executable, and ensure the permissions match the other scripts.
 * 1) !/bin/sh

minecraft_session="minecraft_session" minecraft_args="/usr/local/jdk-1.7.0/bin/java -Xms1536M -Xmx1536M -jar /var/games/minecraft/minecraft_server.jar nogui"

daemon="/usr/local/bin/screen" daemon_user="minecraft" daemon_flags="-d -m -S ${minecraft_session} ${minecraft_args}"

. /etc/rc.d/rc.subr

rc_reload=NO

rc_check { pkill -0 -f "/usr/local/bin/SCREEN ${daemon_flags}" }

rc_stop { ${rcexec} "${daemon} -p 0 -S ${minecraft_session} -X eval 'stuff stop\015'" }

rc_cmd $1 /etc/rc.conf.local and append ' minecraft' to the "pkg_scripts" line pkg_scripts=$(some package scripts) minecraft
 * edit
 * 1) rc.d(8) packages scripts
 * 2) started in the specified order and stopped in reverse order

At this point it should be able to it start/stop and have it auto-load on boot.

教程/OpenBSD 启动脚本