minecraft-bukkit-start-script/hub-service

65 lines
957 B
Plaintext
Raw Permalink Normal View History

2022-01-15 14:04:11 +01:00
#!/sbin/openrc-run
description="SFS Minecraft hub server"
extra_started_commands="console"
console() {
hub-console -f
}
_hub_status() {
hub-status > /dev/null
}
depend() {
need waterfall-service
}
start_pre() {
mark_service_starting
}
start() {
hub-start
}
start_post() {
mark_service_started
}
status() {
if service_stopping; then
ewarn "status: stopping"
return 4
elif service_starting; then
ewarn "status: starting"
return 8
elif service_inactive; then
ewarn "status: inactive"
return 16
elif service_crashed; then
eerror "status: crashed"
return 32
elif ! _hub_status; then
mark_service_stopped
einfo "status: stopped"
return 3
else
mark_service_started
einfo "status: started"
return 0
fi
}
stop_pre() {
if _hub_status; then
mark_service_started
else
mark_service_stopped
fi
}
stop() {
service_started && eend "use \`rc-service $RC_SVCNAME console\` and enter the \`stop\` command manually"
}