Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 5 of 5
  1. #1
    Join Date
    August 2010
    Location
    Perth, Australia
    Posts
    1

    How to run TeamSpeak 3 server on FreeBSD as a daemon

    Now that the TeamSpeak 3 server beta has been made available on FreeBSD (thank you!) I have finally been able to upgrade from TeamSpeak 2. The tarball supplied works without modification, but you have to run the teamspeak server manually. It doesn't tie into the standard FreeBSD rc start script system to allow it to be started automatically when your server starts - like what the FreeBSD port wrapper of TeamSpeak 2 came with.

    Not being a FreeBSD guru, I searched for a while to try to find the best way to do it. Not finding much suitable, I knuckled down and rolled my own. Here it is for the benefit of anyone else trying to do something similar. As I said, I'm not a FreeBSD guru, so I welcome any feedback as to a better/simpler way to do it! Eventually I expect (hope) TeamSpeak 3 server will be packaged up into a FreeBSD port which will take care of all of this.

    Starting assumptions:
    1. You have downloaded and successfully installed the latest FreeBSD TeamSpeak 3 tarball.
    2. It is installed in /usr/local/lib/teamspeak3-server_freebsd-x86
    3. You have a 'teamspeak' user and group on your server, and that directory (and all contents) are owned by that user.
    4. You can successfully run the TeamSpeak 3 server as the 'teamspeak' user using both of the supplied start scripts in the tarball (ts3server_startscript.sh and ts3server_minimal_runscript.sh).

    Now to add the hooks into the FreeBSD rc script system: create a new shell script in the /usr/local/lib/teamspeak3-server_freebsd-x86 directory as follows:

    /usr/local/lib/teamspeak3-server_freebsd-x86/ts3server.sh:

    Code:
    #!/bin/sh
    
    export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
    export PATH=".:$PATH"
    cd "$(dirname "${0}")"
    /usr/sbin/daemon -f -p ts3server.pid ts3server_freebsd_x86 [email protected]
    Make sure that shell script is owned by teamspeak and executable.

    Create an rc script for TeamSpeak 3 as follows:

    /usr/local/etc/rc.d/teamspeak3-server:

    Code:
    #!/bin/sh
    #
    # PROVIDE: teamspeak3
    # REQUIRE: DAEMON
    # KEYWORD: shutdown
    #
    # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
    # to enable this service:
    #
    # teamspeak3_enable (bool):     Set to NO by default.
    #                               Set it to YES to enable teamspeak3.
    #
    
    . /etc/rc.subr
    
    name="teamspeak3"
    rcvar=`set_rcvar`
    teamspeak3_user="teamspeak"
    command="/usr/local/lib/teamspeak3-server_freebsd-x86/ts3server.sh"
    procname="ts3server_freebsd_x86"
    pidfile="/usr/local/lib/teamspeak3-server_freebsd-x86/ts3server.pid"
    
    load_rc_config $name
    run_rc_command "$1"
    Add a line to /etc/rc.conf to enable TeamSpeak 3:

    Code:
    teamspeak3_enable="YES"
    That's it! Reboot your FreeBSD box and TeamSpeak 3 should start automatically.

    Alternatively, you can manually start the server as follows:

    Code:
    # /usr/local/etc/rc.d/teamspeak3-server start
    All of the standard FreeBSD rc commands are available:

    Code:
    # /usr/local/etc/rc.d/teamspeak3-server
    Usage: /usr/local/etc/rc.d/teamspeak3-server [fast|force|one](start|stop|restart|rcvar|status|poll)
    Hope that helps someone.
    Last edited by Riporski; August 18th, 2010 at 10:49 AM.

  2. #2
    Join Date
    July 2008
    Location
    Canada
    Posts
    21
    Thanks a bundle for this tutorial.. I was going through this headache myself today and am happy as hell that the first google link that comes up will help me instead of having to search around and experiment for a couple of hours

  3. #3
    Join Date
    September 2011
    Posts
    1

    Lightbulb Boot on startup, help me please!

    Hi all.

    I want to do auto start up my teamspeak 3 server when i type reboot on my freebsd server. How to do it? Please for fast help. Thank'u.

    *** Thread Merged ***
    Last edited by florian_fr40; September 20th, 2011 at 10:20 AM.

  4. #4
    Join Date
    December 2012
    Posts
    1
    I know it's been awhile, but this post absolutely ROCKS.
    I would like to add one thing that I encountered. If you follow this procedure, and teamspeak3 still will not start on boot:
    Go to /usr/local/lib/teamspeak3-server_freebsd-x86/logs/
    Look at the last log. If you see THIS line in your logs:

    Code:
    |ERROR   |ServerLibPriv |   | Server() error while starting servermanager, error: instance check error
    If you search the forums, everyone (EVERYONE) will try to direct you to the FAQ, which will help you solve this problem... on Linux. You'll see this in the FAQ:

    Code:
    mount -t tmpfs tmpfs /dev/shm
    Only this doesn't work in FreeBSD. I was able to get past this by enabling a ramdisk in FreeBSD.

    http://forums.freebsd.org/showthread.php?t=20345

    Specifically, edit your rc.conf file, and create a ramdisk:

    Code:
    tmpmfs="YES" 
    tmpsize="100m" 
    tmpmfs_flags="-S"
    And then reboot. This should fix that problem.

  5. #5
    Join Date
    December 2012
    Posts
    8
    I just put teamspeak in a cronjob which gets executed @reboot. Very easy and works like a charm

    Execute this command:

    EDITOR=nano crontab -e
    Then put this in the crontab:
    @reboot /home/servers/teamspeak3-server_linux-amd64/ts3server_startscript.sh start
    Remember to replace /home/servers/ to where your teamspeak3-server directory is.

    Have fun.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Teamspeak 3 @ V-Server with FreeBSD
    By derul in forum Linux / FreeBSD
    Replies: 1
    Last Post: October 15th, 2012, 04:17 PM
  2. Teamspeak Server on FreeBSD VPS 64
    By noname11 in forum Linux / FreeBSD
    Replies: 8
    Last Post: March 12th, 2010, 01:51 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
  •