Jump to content

Web Server restarter


Recommended Posts

Today I told an Admin server 3 has been up for -1 hour and 49 mins (Basically 1 hour and 49 mins after restart was suppose to happen because of lag/desync).

 

I would like to propose we make a authenticated login for a admin server restarter as the message I got back when I told him is I messaged the dev's and that is all I can do. Because of the current state of the servers this seems like a good tool to have for the admins. As luckily on this server it seems like there is almost always an admin on one of the servers. I am a web developer by profession if you guys don't typically do web development I could create the script if you guys just told me what directory to use to execute on for the startup. 

 

For developers:

I was thinking of this in PHP as its what I use at work so I have a lot of hours in it, but any back-end language would work:

- Create a page, with some type of authentication. You may be able to Invisions forum software to embed a page and give it permissions based on a forum account so you don't have to make a new authentication. This would be ideal, we can even track users this way but the alternative is making new accounts for all the admins.

- A selector for Server 1,2,3

- I was thinking of having a few buttons

-- Hard restart: This would kill the current PID the server is running on and exec the startup/launch script again, which for PHP I am not sure about killing a process (would have to do some research, but I dont see why not) but I do know we can launch/execute a process.

-- Increment restart: The message shown for 30/15/10/5/1 etc. Now I havent really done ALOT of Arma development and by that I mean I probably have only about 30mins-1hour in Arma 2 development so I don't know too much of how the server would work but I would assume you guys have a script to launch for each of those that we could target, If not then.... Maybe we could make em? -- I could come up with something I am sure. But just an idea.

 

Thats my suggestion, if you guys would like me to do it I am requesting the donor perk where you spawn with an ATM card in return -- Also if any of the developers are curious about my background I have a portfolio site I can DM you,

Thanks.

Edited by DiversityCSGO
Farmer Steve, Walt, WiIIiam and 1 other like this
Link to comment
4 minutes ago, DiversityCSGO said:

Today I told an Admin server 3 has been up for -1 hour and 49 mins (Basically 1 hour and 49 mins after restart was suppose to happen because of lag/desync).

 

I would like to propose we make a authenticated login for a admin server restarter as the message I got back when I told him is I messaged the dev's and that is all I can do. Because of the current state of the servers this seems like a good tool to have for the admins. As luckily on this server it seems like there is almost always an admin on one of the servers. I am a web developer by profession if you guys don't typically do web development I could create the script if you guys just told me what directory to use to execute on for the startup. 

 

For developers:

I was thinking of this in PHP as its what I use at work so I have a lot of hours in it, but any back-end language would work:

- Create a page, with some type of authentication. You may be able to Invisions forum software to embed a page and give it permissions based on a forum account so you don't have to make a new authentication. This would be ideal, we can even track users this way but the alternative is making new accounts for all the admins.

- A selector for Server 1,2,3

- I was thinking of having a few buttons

-- Hard restart: This would kill the current PID the server is running on and exec the startup/launch script again, which for PHP I am not sure about killing a process (would have to do some research, but I dont see why not) but I do know we can launch/execute a process.

-- Increment restart: The message shown for 30/15/10/5/1 etc. Now I havent really done ALOT of Arma development and by that I mean I probably have only about 30mins-1hour in Arma 2 development so I don't know too much of how the server would work but I would assume you guys have a script to launch for each of those that we could target, If not then.... Maybe we could make em? -- I could come up with something I am sure. But just an idea.

 

Thats my suggestion, if you guys would like me to do it I am requesting the donor perk where you spawn with an ATM card in return -- Also if any of the developers are curious about my background I have a portfolio site I can DM you,

Thanks.

im p sure admins can restart servers

Link to comment
On 7/12/2018 at 11:37 PM, Batcan said:

Yeah so this is a good idea. Especially if the servers are taking a shit and a restart may help lag.

Once again, I don't have experience with Arma servers but from the knowledge, I do have of them. Desync is really a registration issue with the servers current state. So if player 1 is at coordinate 123 - 123 and Player 2 is at coordinate 321 - 321 then Player 1 has to register player 2 is at that coordinate but it goes through the server as a middleman. The server should broadcast to Player 1 that Player 2 is at 321 - 321. But it seems like because of my experience so far with our desyncing issues it's not the normal desync latency that arma experiences (For example when you ram in front of a car to actually ram them client sided). Meaning its not a client sided desync (that's not confirmed -- with all the add-ons asylum has it could cause a client sided desync, but more than likely not because when the desync does happen it happens server wide for everyone), So if the server is having issues with Syncing the registrations then we could have one instance of the program (which I believe they said they hired someone to try an fix) that throws a wrench in player registration OR in most games they have something similar to streamline data connection to the server that could be breaking and re-establishing its self. Either way its on the server. As soon as that server restarts the original wrench that broke up those registrations/streamlined data will be gone AKA our desyncing issue. After that its fine and dandy until the program hits that wrench in the code again. Also if you read this far you are probably interested in this so my hypothesis also could be hit more than once causing MORE and MORE desync over time. So it could start off right away when the server restarts -- which another idea is lower the restart timer (however that kinda sucks considering the fields move every restart -- maybe we can configure them to move every 2 restarts and we break the timer in half?) 

 

None of my information is confirmed, just idea's from a career developer you can never tell with this stuff until you start debugging the code. 

 

TLDR: Yes a restart should fix it, temporarily until the server desyncs again

Edited by DiversityCSGO
Link to comment

No one was answering, and servers are still getting annoying so I just went ahead and made the code:

 

You can view it Here

Here is the code if yall wanna use it, just install PHP (You shouldnt have to considering the forums is using PHP -- but dunno if your web server and game servers are on the same server). I was also thinking while making this all your servers are on different IP's soooo basically an alternative to what I made is we make the navbar on the left point to each hosted ip share of the same file that way when you use one of the buttons the directory is used locally for the server. Anyways heres the code if yall have any questions just ask.. Kinda doubt anyone cares considering this died but I thought if I wrote the code up you might think about using it instead of letting this die out.

 

asylum.php:

<html>
  <head>
    <title>Home</title>

    <link rel="icon" href="images/favicon.ico" type="image/ico">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
    <style>
      body {
        background: #232526;  /* fallback for old browsers */
        background: -webkit-linear-gradient(to right, #414345, #232526);  /* Chrome 10-25, Safari 5.1-6 */
        background: linear-gradient(to right, #414345, #232526); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
        overflow: auto;
      }

      .contentContainer {
        margin-top: 5rem;
        margin-left: 18rem;
        margin-right: 5rem;
        height: 80%;
        text-align: center;
      }

      .contentDiv {
        text-align: center;
        margin: 0 auto;
        color: white;
      }

      #nav {
        font-size: 1.2em;
        box-shadow: -1px 5px 10px 5px black;
      }

      #nav a.item:hover:not(.active) {
        background-color: black;
        color:white;
        opacity: .5;
      }

      .contentPoint {
        font-size: 1.2em;
        margin-bottom: 15px;
        display:block;
      }

      .dashContentPoint {
        font-weight: bolder;
      }


      .item h3 {
        margin: 0;
      }

      .active {
        background: #333 !important;
        opacity: .5;
        color: white !important;
        cursor: default !important;
      }

      .fa {
        margin-right: 10px;
        width: 20px;
      }

      .server {
        display: none;
      }

      .startFunction {
        width: 300px;
      }
    </style>
  </head>

  <body>

    <div id="nav" class="ui left fixed vertical menu">
      <div class="item" style="background: #333;">
        <h3 style="text-align: center; color: white;">Asylum Server Restarter</h3>
      </div>
      <a class="item active" data-container="one"><i class="fa fa-home" aria-hidden="true"></i>Server 1</a>
      <a class="item" data-container="two"><i class="fa fa-home" aria-hidden="true"></i>Server 2</a>
      <a class="item" data-container="three"><i class="fa fa-home" aria-hidden="true"></i>Server 3</a>
    </div>

    <div id="server_one" class="contentContainer activeServer">
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (1) restart 1 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (1) restart 5 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (1) restart 10 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (1) restart 15 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (1) restart 20 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (1) restart 30 min</button><br><br>
    </div>

    <div id="server_two" class="contentContainer server">
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (2) restart 1 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (2) restart 5 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (2) restart 10 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (2) restart 15 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (2) restart 20 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (2) restart 30 min</button><br><br>
    </div>

    <div id="server_three" class="contentContainer server">
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (3) restart 1 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (3) restart 5 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (3) restart 10 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (3) restart 15 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (3) restart 20 min</button><br><br>
      <button class="startFunction ui button blue" data-dir="./lul.exe">Server (3) restart 30 min</button><br><br>
    </div>
  </body>
</html>

<script>
$(document).on('click', '.startFunction', function() {
  let dir = $(this).data('dir');

  $.ajax({
    url: './asylum_functions.php',
    data: {
      action: 'run',
      request: dir
    },
    type: 'post',
    success: function(output) {
      alert(output);
    }
  });
});

$(document).on('click', '#nav .item', function() {
  let container = $(this).data('container');

  $('#nav .item.active').removeClass('active');
  $(this).addClass('active');

  $('.activeServer').addClass('server');
  $('.activeServer').removeClass('activeServer');

  $('#server_'+container).removeClass('server');
  $('#server_'+container).addClass('activeServer');
});
</script>

 

asylum_functions.php:

<?php
if(isset($_POST['action']) && !empty($_POST['action'])) {
  $dir = $_POST['request'];

  switch($_POST['action']) {
    case 'run':
      run($dir);
    break;
    default:
      throw new Exception("Action not found: {$_POST['action']}");
    break;
  }
}

function run($dir) {
  exec($dir);

  echo "Successfully executed the script.";
}

?>

 

Edited by DiversityCSGO
justi likes this
Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...