Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Backgrounding.....


    Hi, im new to these forums, and i suppose to linux. My friend recently asked me to set up a few HL servers on his dedicated server. Whenever i background the command, i believe it is successful, as the HLDS console ......goes in the background....and the ssh console comes back up. But, when i exit ssh, the HLDS server goes down, and i lag out.

    -Any help appreciated,
    Greg0rz

  2. #2
    lol, HLDS, how familiar those were the days ...... no more college, no more CS

    ok, back to the topic, you have two choices:

    1)
    Code:
    nohup /path/to/hlds --map cs_dust --blablabla --maxplayers 20 &
    (note the nohup and the trailing &)

    this way, it sends the process into the background, and the only way to terminate it is by rcon in game or kill -9

    2) use screen: (search for gnu screen from the net and should return you plenty of results, probably already included in your linux distro)

    Code:
    screen -A -m -d -S hlds /path/to/hlds --map cs_italy --blablabla --maxplayers 12
    and you're returned with a shell prompt.... don worry. to access your hlds screen, type
    Code:
    screen -r hlds
    and you're in, while in the hlds console, to "quit" from screen session, use ctrl-a, release ctrl and press d

    a ha, good luck

  3. #3
    the script that i wrote years ago:

    Code:
    #!/bin/sh
    #####################################################
    # script to start halflife dedicated server on linux
    # only a specific user is allowed to run this
    #
    # by: adam7979
    #####################################################
    
    #the home directory for the normal user
    NORMALUSER="/home/adam"
    
    #the normal user's login name
    USERNAME="adam"
    
    #the halflife dedicated server's directory
    HALFLIFEDIR="/halflife/hlds_l"
    
    #full path to this script plus it's name 
    
    THISSCRIPTNAME="/halflife/hlds_l/startserver"
    
    #end of user input
    #############################################################################
    
    if [ "$USERNAME" = "$USER" ]; then
      echo "id identified. proceed..."
      else
      echo "id denied. existing."; exit
    fi
    
    
    testhlds=`ls $NORMALUSER/.screen|grep hlds|awk -F. {'print $1'}`
    echo "testhlds is $testhlds"
    
    if `kill -CHLD $testhlds >/dev/null 2>&1`;
      then
       echo "Server already started. See now? (y/n)";
       read decision
       case $decision in 
         y|Y ) screen -r hlds; exit;;
         n|N ) echo "exiting..."; exit ;;
       esac
      else
       if test -e $NORMALUSER/.screen/$testhlds.hlds; then
        rm $NORMALUSER/.screen/$testhlds.hlds > /dev/null
       fi
    fi
    
    
    HOME=$NORMALUSER
    export LD_LIBRARY_PATH=$HALFLIFEDIR:$LD_LIBRARY_PATH
    ip=`/sbin/ifconfig eth0|grep "inet addr:"|awk -F: {'print $2'}|cut -d\    -f 1`
    
    echo "starting counter-strike dedicated server."
    echo "maxplayers? (default: 28)"
    read mp
    
    case $mp in "" ) mp=28 ;;
    esac
    echo "map available:"
    cd $HALFLIFEDIR/cstrike/maps
    ls -C *.bsp
    echo "map? (default: de_dust)"
    read map
    
    case $map in "" ) map=de_dust ;;
    esac
    
    echo "maximum player: $mp"
    echo "map           : $map"
    echo "server ip     : $ip"
    echo "is that correct? (y/n)"
    
    read decision
    case $decision in 
       n|N ) exec $THISSCRIPTNAME ;;
       y|Y ) cd $HALFLIFEDIR; screen -A -m -d -S hlds ./hlds_run -game cstrike +maxplayers $mp +map $map +sv_lan 1 -nomaster +ip $ip ;;
    esac
    echo "starting server. please wait..."
    sleep 1
    echo "."
    sleep 1
    echo "."
    sleep 1
    echo "."
    echo " "
    
    $THISSCRIPTNAME

  4. $spacer_open
    $spacer_close
  5. #4
    thanks for the help guys ^_^, i got it running now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •