Forum

Results 1 to 4 of 4
  1. #1
    Join Date
    December 2015
    Location
    Germany
    Posts
    4

    Save Energy with Ubuntu Server

    Hello everybody,

    I have recently migrated my TeamSpeak3 Server from Windows to Ubuntu Server 14.04.3.
    Under Windows, I could use a program to check for network traffic and suspend the server when there was no traffic.
    Searching for an alternative option for Ubuntu, Googleing could not provide me any solutions. So maybe someone here has got a solution he/she can offer?

    What I have got:
    Running TeamSpeak3 Server "implemented" as daemon (via init.d) on Ubuntu Server 14.04.3
    The Server awakens from suspension via WOL.

    What I want:
    Save Energy by suspending the server when noone is accessing TS3Server.

    Thanks in advance!

    Regards!

    dunno27

  2. #2
    Join Date
    December 2015
    Location
    Germany
    Posts
    4

    Finally got it working!

    What I used was the following script as my basic script:
    https://wiki.ubuntuusers.de/Skripte/AutoSuspend/

    I then added in autosuspend.sh the following function:
    Code:
    IsTS3Running()
    {
    echo -e "use sid=1\n serverlist\n quit" | \
    nc '127.0.0.1' '10011' | tr -d "\r" | {
    while read -r line; do
    echo "$line" >> /etc/checkconnection/list
    done
    } || return 1
    _online=$(grep -Po 'virtualserver_clientsonline=\K.*(?= virtualserver_queryclientsonline)' /etc/checkconnection/list)
    rm /etc/checkconnection/list
    if [ "$_online" -eq '0' ]
    then
    return 0
    elif [ "$_online" -eq '1' ]
    then 
    return 0
    else
    logit TS3 is still active, auto shutdown terminated
    return 1
    fi
    }
    Basically what this part of code does ist that it connects to the server query, sets the used server-id to 1 and gets the serverlist, which contains the count of connected users. If there's more than one user connected it terminates the shutdown script. Otherwise the script continues.
    More than one user was neccessary for me as it counted the connection to the server query as an user.

    You have to add the following code in the same script to the "IsBusy-Function"

    Code:
    IsTS3Running
    if [ "$?" == "1" ]; then
    return 1
    fi
    This piece of code runs the function we have scripted before and tells the script to abort autoshutdown if there are any users connected.

    That's maybe not the most elegant solution, but it is working for me and maybe some of you guys are having the same problem.

    Regards!
    Last edited by dunno27; April 9th, 2017 at 05:56 PM. Reason: * fixed typos in Script

  3. #3
    Join Date
    January 2017
    Posts
    1

    Unfortunately it doesn't work for me

    Dear dunno27,

    i used to stumble over your thread since I was trying to setup my AutoSuspend-script the same way you did. I pasted your original posted code accordingly to the script file.

    At first I was faced with a syntax error:
    "syntax error: unexpected word ||
    '||return 1'
    I then tried out to remove the line break and put it right behind the first '}' .

    Secondly, behind the _online=$ -part, I guess there should follow a '(' instead of a '{' if I am not assuming this wrong.

    Unfortunately the new script output states that the data or dir cannot be found.
    Since my scripting abilities are very restricted I hoped that you might help me out on this one.
    Perhaps there's a possibility to repost your original code from your script, presumed your server is still up, or recheck the part of your code, if there's anything missing.

    I would be delighted if I finally get this to work.

    Sorry that I had to push this thread up again but I did not found any proper solution out there, that would do the job for me.

    Kind regards,
    phx

  4. #4
    Join Date
    December 2015
    Location
    Germany
    Posts
    4
    Dear phx88,

    you were right, there were two small typos in the script. I Have edited it according to my latest version on my server. Unfortunately I am not using this script anymore since my server is running 24/7, but I HAVE used it and it HAS WORKED
    As far as your error is concerned: Do you have a folder "/etc/checkconnection"? This will be needed for the script to save the test file. If you want to use another folder you can simply replace it in the script. Other than that I have no idea what this error could possibly else mean if you followed the tutorial from ubuntuusers.de

    Sorry for replying so late, I haven't got any notice about your reply.

    If you have further questions feel free to contact me either in this thread or via pm.

    Kind regard
    dunno27

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: January 19th, 2014, 06:49 PM
  2. Capture Profile and the Win7 Energy Saving :/
    By gna445 in forum Bug Reports [EN/DE]
    Replies: 0
    Last Post: September 9th, 2010, 02:11 PM

Posting Permissions

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