Thread: How to run Sven Co-op Dedicated server on Linux !

Results 1 to 10 of 10
  1. #1
    Unregistered User Yuraj's Avatar
    Join Date
    Jul 2010
    Location
    Slovakia
    Posts
    83

    Lightbulb How to run Sven Co-op Dedicated server on Linux !

    Hi all,
    so here is my short guide:

    How to run Sven Co-op server on Linux with WINE (tested on Debian Lenny over SSH):


    1. LINUX: First download and install these packages on linux: wine_1.1.42+ and winbind(not sure if it is really needed)
    (it won't work with older version of wine)

    2. WIN: You need do these actions in Windows:
    > first install svencoop somewhere in your PC
    > install svencoop patch (e.g.: 4.07)
    > download and install HldsUpdateTool

    3. LINUX: Create a directory on your server (for example HLDS).

    4. WIN: Copy executable of installed HldsUpdateTool where did you install hldsupdatetool (HldsUpdateTool.exe) into your HLDS directory on server.

    5. LINUX: Run on server command to download necessary HL files:
    Code:
    wine hldsupdatetool.exe -command update -game valve -dir .
    6. WIN: Copy all "svencoop" directory to HLDS directory on server.

    7. LINUX: To RUN Sven Coop server:
    > in terminal locate to your HLDS directory, for example: cd hlds
    > execute this command:
    Code:
    wine hlds -console -game svencoop +map svencoop1 +maxplayers 15 -num_edicts 4096
    (you will not see hlds console output, don't use winconsole - it crashs hlds on many maps)


    Metamod, AMX Mod X, HookMod, EntMod works 100%!
    Last edited by Yuraj; 29-08-2010 at 06:45 PM.

  2. #2
    Administrator Sven Viking's Avatar  
    Manager
    Join Date
    Aug 2001
    Location
    New Zealand
    Posts
    8,099

    Re: How to run Sven Co-op Dedicated server on Linux !

    Wow, impressive that you got this working!

    You need to add "-num_edicts 4096" to your commandline for certain maps to run, by the way. e.g.

    <strike>wineconsole hlds -console -game svencoop +map svencoop1 +maxplayers 12 -num_edicts 4096</strike>
    Sven Viking

  3. #3
    Unregistered User Yuraj's Avatar
    Join Date
    Jul 2010
    Location
    Slovakia
    Posts
    83

    Re: How to run Sven Co-op Dedicated server on Linux !

    Thanks I forget for that.

    So I finally solved the problem:
    You have to run it by command wine not wineconsole (anyway you will not see console output but it will works 100%!!)

    Code:
    wine hlds -console -game svencoop +map svencoop1 +maxplayers 15 -num_edicts 4096
    It works great! Now you should write your own script, which will check if server crashed => then hlds will be restarted..

  4. #4
    Administrator Sven Viking's Avatar  
    Manager
    Join Date
    Aug 2001
    Location
    New Zealand
    Posts
    8,099

    Re: How to run Sven Co-op Dedicated server on Linux !

    Excellent -- nice work! Maybe we could mention this in a news post.
    Sven Viking

  5. #5
    Registered User
    Join Date
    Apr 2003
    Location
    Missouri, US
    Posts
    6,344

    Re: How to run Sven Co-op Dedicated server on Linux !

    Quote Originally Posted by Yuraj View Post
    Thanks I forget for that.

    So I finally solved the problem:
    You have to run it by command wine not wineconsole (anyway you will not see console output but it will works 100%!!)

    Code:
    wine hlds -console -game svencoop +map svencoop1 +maxplayers 15 -num_edicts 4096
    It works great! Now you should write your own script, which will check if server crashed => then hlds will be restarted..
    Adjust codes as needed.

    dirserver.bash
    Code:
    #!/bin/bash                                               
    ###############################################################################
    # This script checks the pid of a program and if its greater than 0 its       #
    # running If not it executes the program                                      #
    #                                                                             #
    #                                                                             #
    #                                                                             #
    ###############################################################################
    # Author information   ########################################################
    ###############################################################################
    #                                                                             #
    #  Ryan C  12/30/2009                                                         #
    #  For General use                                                            #
    #                                                                             #
    #                                                                             #
    ###############################################################################
    # Change log                                                                  #
    ###############################################################################
    ##                                                                            #
    ##  1/5/2010   Initial release of code.                                       #
    ##                                                                            #
    ##                                                                            #
    ##                                                                            #
    ##                                                                            #
    ##                                                                            #
    ###############################################################################
    # Variable Section   ##########################################################
    PIDOF=`pidof dirserver`    #name of program to monitor                              
    PROGRAM='./subdomains/ds/dirserver'        #set where the program lives                             
    LOG_FILE=logall.`date +%m%d%y`                                                 
    ###############################################################################
    {                                                                              
    if [ ${PIDOF} -gt "0" ]; then                                                  
    echo "$PROGRAM is running." >> ${LOG_FILE}                                     
    else                                                                           
    echo "$PROGRAM is not running $PROGRAM is being started." >> ${LOG_FILE}       
    $PROGRAM                                                                       
    fi                                                                             
    }                                                                              
    WRITE_LOG_HEADER ()                                                            
    
    {
    echo "#  Begin WRITE_LOG_HEADER function"
    
    #    echo "###############################################################################"
     >> ${LOG_FILE}
    #    echo "#                           TRANSFER LOG                                      #" >> ${LOG_FILE}
    #    echo "###############################################################################"
     >> ${LOG_FILE}
    #    echo "Transfer log for `date`" >> ${LOG_FILE}
        echo >> ${LOG_FILE}
    #    echo >> ${LOG_FILE}
    
    echo "#  End WRITE_LOG_HEADER function"
    }
    #
    #
    WRITE_LOG_FOOTER ()
    {
    echo "#  Begin WRITE_LOG_FOOTER function"
    
                    echo >> ${LOG_FILE}
                    echo >> ${LOG_FILE}
                    echo >> ${LOG_FILE}
    #    echo "###############################################################################"
     >> ${LOG_FILE}
    #    echo "#                    TRANSFER LOG COMPLETED                                   #" >> ${LOG_FILE}
    #    echo "###############################################################################"
     >> ${LOG_FILE}
    #    echo "Transfer log for `date`" >> ${LOG_FILE}
        echo >> ${LOG_FILE}
        echo >> ${LOG_FILE}
    
    echo "#  End WRITE_LOG_FOOTER function"
    }
    #
    #
    SEND_LOG ()
    {
    echo "#  Begin SEND_LOG function"
    
        cat ${LOG_FILE} | mail -s "Transfer Log: ${LOG_FILE}" admin@hlrse.net
    
    echo "#  End SEND_LOG function"
    }
    
    WRITE_LOG_HEADER
    WRITE_LOG_FOOTER
    SEND_LOG
    dirserver.py
    Code:
    #/usr/bin/python
    #Python Script for L.C.
    #Saturday Jan 2nd 2010, 23:24
    #by Christopher Burke krslynx@gmail.com
    #2010/Jan/02 - Made edits, made it easier to understand
    
    """To Run This Script:
    open utilities->terminal and execute:
    $ python /home/bluetds2/4990_dirserver.py
    You will need to check that processName variable matches the process
    that you're _running_, and you will need to make sure that the correct
    path to the process that you're trying to _run_ is located within the path
    field on line 23"""
    
    import os
    import sys
    import subprocess
    
    processName = "dirserver" # the process to check
    
    def runProcess(): # this function will run the below application
            # If you want to change what application it opens, change the below path
            subprocess.Popen(['/home/hlrse/subdomains/ds/dirserver'])
            # If you want a script that checks multiple directory servers
            # (I've got no idea why you'd need this) then I guess that can be arranged.
    
    def checkProcess(): 
            
            """ This function will effectively run ps -A | grep <appname>
            in the shell - therefore it will be checking if processName is running
            so for multiple instances, you'll need to edit the processName variable
            to the closest path possible."""
            
            for line in os.popen("ps -A | grep " +processName):
                    fields = line.split() # This is splitting the output of the above
                    pid = fields[0] # and this is grabbing the leftmost output (pid)
                    print "pid for", processName, 'is', pid # this is non-essential
                    check = os.path.exists("/proc/" +pid) # this part of the script is
                    # checking if a /proc/<pid> folder has been created (ie. if the proc-
                    # ess exists)
                    if check == True:
                            # if the check is true...
                            print processName, "was running, goodbye!" # it was running
                            exit() # so exit
                    else: # otherwise, run the runProcess function, found at line: 12
                            runProcess()
    
    """MAIN"""
    print "Checking if dirserver is running..." # This line is non-essential
    checkProcess() # check process
    runProcess() # run process, check process exits the script first anyway...
    dirserver.sh
    Code:
    #!/bin/sh
    cd ~/subdomains/ds
    for (( ; ; ))
    do
      ./dirserver > logall.txt
    done
    Additionally, you can use nohup stuffToExecuteHere& (the & at the end will make it go into shell background, and nohup should make said execute run in system/ps background).

  6. #6
    Someone Special cscarlet's Avatar  
    Contributor
    Join Date
    May 2002
    Location
    Mr Magics SC Server
    Posts
    6,402

    Re: How to run Sven Co-op Dedicated server on Linux !

    hmm I would be interested to know how stable the server is under wine

  7. #7
    Game tester  
    Tester
    Join Date
    Aug 2009
    Location
    Sao Paulo, Brazil
    Posts
    212

    Re: How to run Sven Co-op Dedicated server on Linux !

    I'm running with this script

    sven.sh

    Code:
    #!/bin/bash
    echo Alterando diretorio...
    cd ~/hldsruindows
    echo Executando Svencoop server wine + screen 
    screen -S SC wineconsole --backend=curses hlds.exe -secure -game SvenCoop -port 27019 -pingboost 3 -num_edicts 4096 -console -maxplayers 10 +ip 187.74.157.132 +map abandoned
    I only have problems with big maps, server cpu isn't good (i have a dedicated pc in my home for servers only, Debian lenny)
    And "wine" dont work because i dont installed the "X" (graphic interface)
    Last edited by R4to0; 30-08-2010 at 10:02 PM.

  8. #8
    Mapper Poka's Avatar
    Join Date
    Apr 2006
    Location
    Finland
    Posts
    64

    Re: How to run Sven Co-op Dedicated server on Linux !

    I've been running my server with Wine for some time now. The only problem I've encountered is that when some map crashes, the hlds.exe won't shut down because of the error message and my script won't detect the crash. So at the moment my crontab is set kill and restart the server every 3rd day just in case.
    I'm not too familiar with bash scripting so can anyone say if those scripts that Qwerty posted will help me?
    miittinki

  9. #9
    Registered User
    Join Date
    Apr 2003
    Location
    Missouri, US
    Posts
    6,344

    Re: How to run Sven Co-op Dedicated server on Linux !

    Those scripts were made specifically for me by members of the Subspace community (ssforum.net) to automatically restart a game list master server if it were to crash. All three of those scripts will or should automatically restart configured process if it were to crash. They're just different methods of approach (and funnily enough, different languages).

    dirserver.sh would be the simplest and easiest to run. To kill that, you have the kill the script itself and then hlds. The second line: you navigate to the directory on your system that contains hlds. 5th line: replace the entire line with the execution line that Yuraj provided.

    Then, execute dirserver.sh (or whatever you renamed it to) with 'sh dirserver.sh&' (without the '). Should work.

  10. #10
    Unregistered User Yuraj's Avatar
    Join Date
    Jul 2010
    Location
    Slovakia
    Posts
    83

    Re: How to run Sven Co-op Dedicated server on Linux !

    Here is also good trick if you have slow upload and you dont want upload svencoop directory over FTP. You can download it on remote server (use wget to download file):
    At first navigate to your HLDS directory on server (for example cd hlds)
    Code:
    wget http://sc.svencoop.org/files/svencoop45.rar
    Then install unrar for extracting RAR archives:
    Code:
    apt-get install unrar
    And finally extract your svencoop in HLDS directory:
    Code:
    unrar x svencoop45.rar svencoop
    //Edit
    If you want install UNRAR, probably you will need add sources to file /etc/apt/sources.list (you can use for example nano to append these lines in file).
    This is example for Debian Lenny!
    Code:
    deb ftp://ftp.us.debian.org/debian/ lenny non-free
    deb http://security.debian.org/ lenny/updates non-free
    deb http://volatile.debian.org/debian-volatile lenny/volatile non-free
    Then dont forget for: apt-get update
    //


    Last edited by Yuraj; 19-06-2011 at 05:18 AM.

Posting Permissions

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