Forum

Results 1 to 11 of 11
  1. #1
    Join Date
    January 2014
    Location
    Longuich
    Posts
    10

    Smile Autostart with php

    Hi,

    I've written a script which any server start or stop. It works!
    Now I wanted that when I shut down the server, stop the auto start (set 0).
    Unfortunately it does not work and there is a mistake.


    Look:
    PHP Code:
    <?php

    require_once('../include/libraries/TeamSpeak3/TeamSpeak3.php');

          
    $server = array( 
                  
    "tsip" => "***********",
                  
    "ts_query_admin" => "serveradmin",
                  
    "ts_query_password" => "******",
                  
    "ts_query_port" => "10010",
              );
          
    $value2 = array(
                  
    "virtualserver_port" => "3000",
          
          );

          try {
                  
    TeamSpeak3::init();
                  
    $ts3_VirtualServer TeamSpeak3::factory("serverquery://".$server["ts_query_admin"].":".$server["ts_query_password"]."@".$server["tsip"].":".$server["ts_query_port"]."");
                  
    $client $ts3_VirtualServer->serverStop('12');
                        
    $ts3_VirtualServer->selectServer($value2['virtualserver_port'], 'port'true);
                        
    $autostart_edit=$ts3->serverEdit(array('virtualserver_autostart'=>$value['auto']));
              
              } catch(
    Exception $e) {
                       echo 
    "Fehler!<br/>ErrorID: <b>"$e->getCode() ."</b>; Error Message: <b>"$e->getMessage() ."</b>;";
              }

    ?>
    The script is based on the framework of @ScP

    The Error: ErrorID: 0; Error Message: node method 'selectServer()' does not exist;

    Can me someone help?

    Thanks,

    Pascal

  2. #2
    Join Date
    April 2011
    Location
    Germany
    Posts
    1,266
    I don't know php or that framework. I know how server query works, and your frame work/script seem to use server query!

    With server query when the server is stopped you can't change the autostart value out of the box. Because the "use sid=xxx" command will fail on a stopped server. To edit a stopped server you'll need the "use sid=xxx -virtual" command.

  3. #3
    Join Date
    January 2014
    Location
    Longuich
    Posts
    10
    Hi,

    I've tried the scrip with stopped and the started server.

    Can you give me an example to the query command?

  4. #4
    Join Date
    April 2011
    Location
    Germany
    Posts
    1,266
    in server query it will look like:

    Code:
    login client_login_name=serveradmin client_login_password=xyz
    serverstop sid=1
    use sid=1 -virtual
    serveredit virtualserver_autostart=0

  5. #5
    Join Date
    January 2014
    Location
    Longuich
    Posts
    10
    Thank you, does anyone have an example for the framework? :/

  6. #6
    Join Date
    December 2004
    Location
    RF
    Posts
    3,006
    You haven't specified, what problem you're trying to solve with such [extraordinary] methods.

  7. #7
    Join Date
    April 2011
    Location
    Germany
    Posts
    1,266
    I think he wants to archive that a server which he stops with his script is and stays stopped even if you restart the whole server instance. To start it again he wants to use his script and no other autostart triggered way.

  8. #8
    Join Date
    January 2014
    Location
    Longuich
    Posts
    10
    Hi,

    I want this script to disable a specific server. This should be done when a customer is in the dunning. For this, the server must be stopped and the automatic start to be switched off.

  9. #9
    Join Date
    April 2011
    Location
    Germany
    Posts
    1,266
    Quote Originally Posted by psorgen View Post
    Thank you, does anyone have an example for the framework? :/
    You might want to try and read the manual of the framework. I think your function call isn't correct.

    selectServer($value2['virtualserver_port'], 'port', true);
    The manual says:
    Code:
    $this->serverSelect($sid, $virtual);
    http://docs.planetteamspeak.com/ts3/...d35c74ed1e24b7

  10. #10
    Join Date
    January 2014
    Location
    Longuich
    Posts
    10
    Ok, thank.
    The Select works.
    But i can't change the autostart.
    PHP Code:
    $ts3_VirtualServer->modify(array('virtualserver_autostart'=>0)); 
    It doesnt work :/

  11. #11
    Join Date
    April 2011
    Location
    Germany
    Posts
    1,266
    As I said, I don't know php or that framework... with server query it works fine.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [Resolved] Autostart on Centos
    By ministorm in forum Linux / FreeBSD
    Replies: 10
    Last Post: February 20th, 2012, 10:14 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
  •