summaryrefslogtreecommitdiff
path: root/community/sauerbraten/sauerbraten-server
blob: b4c79cb7f9c32ddcbeaee4873287a6f1fb3d468b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

SAUER_USER=nobody
LOGDIR=/var/log/sauerbraten
[ -f /etc/conf.d/sauerbraten ] && . /etc/conf.d/sauerbraten

cd /opt/sauerbraten

if [ "$(id -u)" == "0" ]; then
    if [ ! -d "$LOGDIR" ]; then
        mkdir -p "$LOGDIR"
        chown "$SAUER_USER:log" "$LOGDIR"
    fi

    sudo -Hu "$SAUER_USER" \
    nohup /opt/sauerbraten/bin/linux_server \
            >>  "$LOGDIR/main.log" \
            2>> "$LOGDIR/error.log" \
            <   /dev/null  &
else
    bin/linux_server
fi