Autoshutdown and Teamspeak

    • OMV 2.x
    • Resolved
    • Autoshutdown and Teamspeak

      Good Morning,

      I just installed omv yesterday and I am really happy with it so far but there is a minor problem:
      Is there any way to make autoshutdown stop while someone is connected to the teamspeak server? I added all the teamspeak ports (9987,30033,10011,2010,41144,2008) to the list but it seems if someone is just hanging arround without talking there is no activity on any of those. Other ports (ssh, ftp, PLEX, etc) are recognized and work well.
    • Hmm. This could be difficult because you cannot use any of the current methods to recognize a user within the TS server... I also haven´t found anything like a Teamspeak bot, that could create a PID or just a file which could be checked. I also haven´t found anything the other way around - something like a script that could be run and check if the server is empty... I´m not pretty sure, if this is possible at all.
      OMV stoneburner | HP Microserver | 256GB Samsung 830 SSD for system | 4x 2TB in a RAID5
      OMV erasmus| Odroid XU4 | 5TB Data drive | 500GB Backup drive
    • You could create a script or ask the dev of the autoshutdown plugin to add it too the plugin.

      Source Code

      1. Online=$(( echo open localhost 10011; sleep 1; echo "login serveradmin **********"; sleep 1; echo hostinfo; sleep 1; echo "logout"; sleep 1; echo "quit"; sleep 1; ) | telnet | grep -o -P '(?<=virtualservers_total_clients_online=).*(?= virtualservers)')


      Online will equal the number of online users or 0 (zero) if no one is connected.

      You can get the needed info from OMV

      Source Code

      1. TEAMSPEAK_SERVER_QUERY_PORT=$(omv_config_get '//services/teamspeak3/queryport')
      2. SERVERADMIN_PASSWORD=$(omv_config_get '//services/teamspeak3/password')
      [Blocked Image: http://widgets.trakt.tv/users/1f5d0f5ed67f98ed9d06d9849b42dd0e/watched/banner@1x.jpg]
      What I am watching/watched on my Popcorn Hour media player
      omv 2.1.1 stoneburner | 64 bit | omvextrasorg 1.29
      MySQL (Percona) | Newznab | Sonarr | CP | HP | NZBget | YAMJ | CUPS
    • If you want to change the code manually you could add it to /usr/local/bin/autoshutdown.sh just before the return ${CNT}; line.

      Source Code

      1. else
      2. if $DEBUG ; then _log "DEBUG: _check_system_active(): _check_plugin not called -> CNT: $CNT "; fi
      3. fi # > if[ $CNT -eq 0 ]; then
      4. if [ $CNT -eq 0 ]; then
      5. # Do a check for logged-on TS3 users
      6. Online=$((echo open localhost 10011;sleep 1;echo login serveradmin **********;sleep 1;echo hostinfo;sleep 1;echo quit;sleep 1) | telnet 2> /dev/zero | grep -o -P '(?<=virtualservers_total_clients_online=).*(?= virtualservers)')
      7. if [ "$Online" > "0" ]; then
      8. let CNT++
      9. if $DEBUG ; then _log "DEBUG: TS3 ${Online} users connected -> CNT: $CNT "; fi
      10. else
      11. if $DEBUG ; then _log "DEBUG: No TS3 users connected -> CNT: $CNT "; fi
      12. fi
      13. fi
      14. return ${CNT};
      Display All


      Maybe @ryecoaaron can add somthing like it to the plugin.
      [Blocked Image: http://widgets.trakt.tv/users/1f5d0f5ed67f98ed9d06d9849b42dd0e/watched/banner@1x.jpg]
      What I am watching/watched on my Popcorn Hour media player
      omv 2.1.1 stoneburner | 64 bit | omvextrasorg 1.29
      MySQL (Percona) | Newznab | Sonarr | CP | HP | NZBget | YAMJ | CUPS
    • tekkb wrote:

      Miller, there is a setting to kick idle users in TeamSpeak. I think this would be the best way to handle this situation.
      ???

      That´s not what he wants to do.

      He just wants to keep his server from shutting down while anybody is connected to his TS. No matter if the person is idle or not.
      OMV stoneburner | HP Microserver | 256GB Samsung 830 SSD for system | 4x 2TB in a RAID5
      OMV erasmus| Odroid XU4 | 5TB Data drive | 500GB Backup drive
    • I did not want to mess with the plugin code as this might be gone every time a new update is released. So I tried my solution. I will write it down, maybe someone will find it useful.

      In /opt/teamspeak3 I created the tscron script:

      Shell-Script

      1. #!/bin/bash
      2. # ts check
      3. Online=$(( echo open localhost 10011; sleep 1; echo "login serveradmin ******"; sleep 1; echo hostinfo; sleep 1; echo "logout"; sleep 1; echo "quit"; sleep 1; ) | telnet | grep -o -P '(?<=virtualservers_total_clients_online=).*(?= virtualservers)');
      4. if (($Online == 0))
      5. then
      6. rm /opt/teamspeak3/ts.lock
      7. else
      8. touch /opt/teamspeak3/ts.lock
      9. fi


      and added it to the cronjobs to run once in 10 minutes. Then I just added a autoshutdown plugin in /etc/autoshutdown.d

      Source Code

      1. folder="/opt/teamspeak3"
      2. file="ts.lock"


      Finally I set

      Source Code

      1. PLUGINCHECK="true"


      in the expert settings in the autoshutdown GUI.
      It works perfectly fine. As long as someone is connected to the server the ts.lock file will prevent any shutdowns from happening.