commit | a146c93b8bbe28b1c4fba8c8c641760d553dae1a | [log] [download] |
---|---|---|
author | WHR <msl0000023508@gmail.com> | Sun Aug 05 20:11:44 2018 +0800 |
committer | WHR <msl0000023508@gmail.com> | Sun Aug 05 20:11:44 2018 +0800 |
tree | 13707c831db8632722b08e279ac9927f7503e63e | |
parent | c56edd0f851a5c3d930a0b12e5e28e3573ca160a [diff] |
SMF: ignore errors on instance startup, so the other successfully started instances will still getting monitored by SMF. BSD init: bug fixes; define 'procname' and 'pidfile' so we got 'status' subcommand.
Configuration file /etc/default/minecraft
|Variable |Description |Default value | |-------------------------------|-------------------------------------------------------|-----------------------| |MINECRAFT_USER_NAME |The user name to run Minecraft server |minecraft | |MINECRAFT_HOME |Home directory of Minecraft server instances |/home/minecraft | |MINECRAFT_START_COMMAND |Server startup command |exec sh start.sh | |MINECRAFT_USE_TMUX |Enable to uses of tmux(1) |NO | |MINECRAFT_SESSION_NAME |Base session name of tmux(1) sessions |minecraft | |MINECRAFT_ALTERNATIVE_LOG_FILE |Redirect outputs to this file if tmux(1) is not used |/dev/null | |MINECRAFT_SERVERS |Space separated server instances | |
Server instances are directories under MINECRAFT_HOME; each server instance will be started under its instance directory by running MINECRAFT_START_COMMAND. Enabling tmux(1) is recommended if using Bukkit server framework, as this server didn't save worlds when exiting on signals. Session name of each server instance will be ‘MINECRAFT_SESSION_NAME-INSTANCE_NAME’.
/etc/default/minecraft
example:
MINECRAFT_HOME=/export/home/minecraft MINECRAFT_SERVERS="1.7-server 1.8-server" MINECRAFT_USE_TMUX=YES
The user (minecraft
by default) must have a sh(1)
compatible shell in order to run shell commands with the default shell.
The startup script (start.sh
by default) must write the PID of server program to server.pid
, and must not fork the server program into background.
start.sh
example:
#!/bin/sh JAVA_HOME=/opt/jdk1.7.0_80 echo $$ > server.pid exec "$JAVA_HOME/bin/java" -jar /opt/minecraft/minecraft-server-1.7.10.jar --nogui
This is very similar with init.d/minecraft
, except the configuration variables are in lower case and set from rc.conf
instead of /etc/default/minecraft
Example configuration in rc.conf
:
minecraft_enable="YES" minecraft_home="/usr/home/minecraft" minecraft_use_tmux="YES" minecraft_servers="1.7-server 1.8-server"
The user and startup script requirements are same with init.d/minecraft
.
minecraft_use_tmux="YES"
svccfg(1M) should be used instead of editing configuration file; configuration properties and its default values are:
$ svccfg -s site/minecraft listprop config config application config/alt_log_file astring /dev/null config/session_name astring minecraft config/start_command astring "exec sh start.sh" config/use_tmux boolean false config/user astring minecraft config/home astring /var/games/minecraft config/servers astring
Example configuration:
# svccfg -s site/minecraft setprop config/home = astring: /export/home/minecraft # svccfg -s site/minecraft setprop config/use_tmux = boolean: true # svccfg -s site/minecraft setprop config/servers = astring: '("1.7-server" "1.8-server")' # svcadm enable site/minecraft