1. When making a thread, please tag your thread accordingly using the menu to the left of the textfield where you name your thread where applicable. Server Advertisements and Mod Releases should be contained to their respective subforums.

Server Discussion Setting up an Ubuntu 12.04 server

Discussion in 'Multiplayer' started by DeMossiah, Dec 5, 2013.

  1. Dzanian

    Dzanian Void-Bound Voyager

    my stategy:
    I have a starbound server script which is using screen. with that script, u can always be sure that the server is undependently running to your linux session (putty i.e.) and running in the background. due to the reason that the starbound server screen label is known, the stop script is able to identify different server sessions and send i.e. ctrl+c to the server for stoping it properly (or every keystokes and words if the server enging changes later)
    the script was originally not written by me, - it was written for minecraft but adapted several times by me for other server engines like terraria .... if u start the script again, its always checking if the server process, with the help of the known screen id, is currently existing, if yes, the script will stop itself doing nothing, if no, it starts the server again. this way i have crontab entries and every 5 minutes the scripts checks if the server is still running. This way my server is 24/7 up.

    i am working on a short auto solotion to stop the server in intervalls and restart it after a universe backup is done.

    anyone having special ideas? anyone interesseted .... ah btw. i am runing the starbound server on ubuntu. (of course :)

    i hope soon we are having more commands for administrating the server from the console.... using runing the server with screen is also giving the possibility to access to the console as often as necessary without stoping the server by itself and totally undepended to your console (via putty)
     
  2. CAH9I

    CAH9I Intergalactic Tourist

    and
    Code:
    insserv -v /etc/init.d/starbound
    for autostart
     
  3. DeMossiah

    DeMossiah Master Chief

    Oh hot damn, completely forgot to add that step, adding it now :viking:
     
  4. Kerpal

    Kerpal Orbital Explorer

    Ok service works now with
    Code:
    chmod +x /etc/init.d/starbound
    Code:
    * Starting Starbound Server Deamon... starbound        [ OK ]
    But i can not connect on the Server


    And also the autostart dont working

    Code:
    insserv -v /etc/init.d/starbound
    command not found
     
    Last edited: Dec 6, 2013
  5. Duglim

    Duglim Intergalactic Tourist

    Hello, I'm not a linux pro, so thx for your great guide here. Everything worked fine so far.
    I was having trouble restarting and stopping the deamon, when i sent the stop or restart signal, I got the feedback from the script, but the server was acually not stopped or restarted. It was still running with the same PID. I solved my issue by sending a KILL command to the PID and restarted the deamon, but using the STOP or RESTART would be cooler. Do you have a hint for me?

    Nevertheless, thanks a lot. :)
     
  6. liamdawe

    liamdawe Subatomic Cosmonaut

    Okay well it runs anyway so not sure what happened.

    Also do we need to do this:
    Each time starbound is updated?
     
  7. Bradlfett

    Bradlfett Orbital Explorer

    Modified init.d script
    • Launches starbound via launch_starbound_server.sh to avoid issues with libraries
    • graceful shutdown via service starbound stop (send SIGINT to all processes in group)
    Code:
    #! /bin/bash
    ### BEGIN INIT INFO
    # Provides:        starbound
    # Required-Start:    networking
    # Default-Start:    2 3 4 5
    # Default-Stop:        S 0 1 6
    # Short-Description:    Starbound Server Daemon
    # Description:        Starts/Stops/Restarts the Starbound Server Daemon
    ### END INIT INFO
    
    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    DESC="Starbound Server Daemon"
    NAME=starbound
    DIR=/home/steam/Steam/SteamApps/common/Starbound/linux64
    DAEMON=$DIR/launch_starbound_server.sh
    PIDFILE=/var/run/$NAME.pid
    SCRIPTNAME=/etc/init.d/$NAME
    
    USER=steam
    GROUP=steam
    DAEMON_ARGS=""
    
    [ -x "$DAEMON" ] || exit 0
    
    . /lib/init/vars.sh
    . /lib/lsb/init-functions
    
    do_start() {
        if [ -e $PIDFILE ]; then
            PID=`cat $PIDFILE`
    
            if ( ps -p $PID > /dev/null ); then
                log_failure_msg "$DESC '$NAME' is already running."
                return 1
            else
                rm -f $PIDFILE
    
                start-stop-daemon --start --background --chdir $DIR --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --quiet --exec $DAEMON --test > /dev/null || return 1
                start-stop-daemon --start --background --chdir $DIR --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --quiet --exec $DAMEON -- $DAEMON_ARGS || return 2
            fi
        else
            start-stop-daemon --start --background --chdir $DIR --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --quiet --exec $DAEMON --test > /dev/null || return 1
            start-stop-daemon --start --background --chdir $DIR --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --quiet --exec $DAEMON $DAEMON_ARGS || return 2
        fi
    }
    
    do_stop() {
        if [ -e $PIDFILE ]; then
            PID=`cat $PIDFILE`
    
            if ( ps -p $PID > /dev/null ); then
                #start-stop-daemon --stop --signal 3 --quiet --pidfile $PIDFILE
                kill -INT -- -$( ps opgid= $PID | tr -d ' ' )
                LAST_STATUS=$?
                [ $LAST_STATUS -eq 0 ] && rm -f $PIDFILE
                [ $LAST_STATUS -ne 0 ] && return 2
            else
                log_failure_msg "$DESC '$NAME' is not running."
                rm -f $PIDFILE
                return 1
            fi
        else
            log_failure_msg "$DESC '$NAME' is not running."
            return 1
        fi
    }
    
    case "$1" in
        start)
            log_daemon_msg "Starting $DESC..." "$NAME"
            do_start
    
            case "$?" in
                0|1) log_end_msg 0 ;;
                1) log_end_msg 1 ;;
            esac
        ;;
        stop)
            log_daemon_msg "Stopping $DESC..." "$NAME"
            do_stop
    
            case "$?" in
                0|1) log_end_msg 0 ;;
                2) log_end_msg 1 ;;
            esac
        ;;
        restart)
            log_daemon_msg "Restarting $DESC..." "$NAME"
            do_stop
    
            case "$?" in
                0|1)
                    do_start
    
                    case "$?" in
                        0) log_end_msg 0 ;;
                        *) log_end_msg 1 ;;
                    esac
                ;;
                *)
                    log_end_msg 1
                ;;
            esac
        ;;
        status)
            if [ -e $PIDFILE ]; then
                PID=`cat $PIDFILE`
    
                if ( ps -p $PID > /dev/null ); then
                    log_success_msg "$DESC '$NAME' is running (pid $PID)."
                    exit 0
                else
                    log_failure_msg "$DESC '$NAME' is not running."
                    rm -f $PIDFILE
                    exit 1
                fi
            else
                log_failure_msg "$DESC '$NAME' is not running."
                exit 1
            fi
        ;;
        *)
            log_action_msg "Usage: $SCRIPTNAME {start|stop|restart|status}"
            exit 0
        ;;
    esac
    
    
     
  8. tab0reqq

    tab0reqq Void-Bound Voyager

    I'm running dedicated server for www.StarboundHQ.pl users on Ubuntu 13.10.

    Simultaneously up to 20 people 24h /365. We have massive lag spikes (form moderate to heavy 30-40 second tree falling).

    Did anyone feom You guys experienced it on ubuntu?

    My server-only PC spec:
    Intel G2020 2x 2,9 Ghz
    8 GB DDR3 Ram
    64 SSD drive

    8 mbit upload
     
  9. entropyrat

    entropyrat Aquatic Astronaut

    Hey, so running that command this is what I see. Obviously there are a ton of warnings, but I can't tell what is up with those, or the failure to place a dungeon. Are these the issues?

    After this it just hangs there, nothing happening.
     
    GennyP likes this.
  10. Ceetee

    Ceetee Void-Bound Voyager

    the chmod code has fixed the issue of the server not starting. It starts now, however no one can connect to it.
     
  11. DeMossiah

    DeMossiah Master Chief

    If people can't connect it's usually a port forward issue, you should forward 21025 to the server. Or to be safe 21025 to 21027. (21026 = controlPort, 21027 = authPort, not sure if they are required to forward)
     
  12. Kaeltis

    Kaeltis Scruffy Nerf-Herder

    Could someone who's experienced with runscripts add an update command like

    Code:
    su - steam -c "/opt/steam/steamcmd.sh +login anonymous +app_update 211820 validate +quit"
    to the modified init.d script?

    The "anonymous" maybe has to be changed to USERNAME PASSWORD.
     
  13. Flylowguy

    Flylowguy Void-Bound Voyager

    I'm getting the following error when I attempt to run launch_starbound_server.sh
    ./starbound_server: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

    EDIT: Installed the package libpng12-0 and it's good now.
     
    Last edited: Dec 7, 2013
  14. DeMossiah

    DeMossiah Master Chief

    Updated the init with that option. Needs steam user info at the vars though, and it's wise to stop the server before you update.

    Code:
    service starbound update
     
  15. aenimosity

    aenimosity Space Hobo

    I'm having an odd issue and hoping someone could help.

    using the launch_starbound_server.sh, the world loads fine and I can hop in the server no problems. However, using the service starbound start script, the game gives me

    * Starting Starbound Server Daemon... starbound [ OK ]

    but doing a "ps aux | grep starbound" shows no starbound process running and doing netstat -an shows no port 21025 being opened. Any ideas?
     
  16. Bradlfett

    Bradlfett Orbital Explorer

    What's the output in the starbound_server.log (located in the linxu64 folder?)
    Have you tried replacing the DEAMON in the startup script with
    Code:
    DAEMON=$DIR/launch_starbound_server.sh
    
     
  17. aenimosity

    aenimosity Space Hobo

    changing the daemon worked! thanks!
     
  18. Dtho_47

    Dtho_47 Star Wrangler

    Why create steam for the second user?
     
  19. EinSof

    EinSof Void-Bound Voyager

    I've tried using this script and when I type service starbound start there are no messages. The command line looks as though I just pressed enter by itself.
    When I type service --status-all it shows the starbound service with a - sign next to it.

    I'm using Ubuntu 12.10 64bit and all I can do is just start my server, wait for the memory to get filled up because of the current problem with worlds not unloading so it keeps adding 30mb to the memory usage till it runs out of memory and crashes.

    I would like to have a service running that will restart the server when it crashes. Any help would be appreciated.
     
  20. Kedziee

    Kedziee Space Hobo

    OK, so I am not understanding what to do with the "Nano" interface. Can you give some direction for your directions after we are able to check that our server has started properly?
     

Share This Page