summaryrefslogtreecommitdiff
blob: 6aa83cc3e1b2f53f7505dfe104a09450a7d6bf1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

command="/usr/sbin/smw-server"
command_background="true"
pidfile="/var/run/${RC_SVCNAME}.pid"
name="Super Mario War server"
description="The Super Mario War server process is in charge of hosting Super Mario War games"
smw_server_dir="/usr/share/supermariowar-2.0_beta1/server"

depend() {
    use net
    before logger
}

start() {
    if [[ ! -d "${smw_server_dir}" ]]; then
        eerror "Cannot cd into ${smw_server_dir}"
        return 1
    fi
    cd "${smw_server_dir}" || return 1
    ebegin "Starting ${name}"
    start-stop-daemon \
        --start \
        --background \
        --pidfile ${pidfile} \
        --make-pidfile \
        --exec ${command}
    eend $?
}

stop() {
    ebegin "Stopping ${name}"
    start-stop-daemon \
        --stop \
        --pidfile ${pidfile}
    eend $?
}