Results 1 to 15 of 828

Thread: Basilisk extended downtime 08/09/2017

Threaded View

  1. #11
    Newbie
    Join Date
    Jan 2017
    Posts
    3
    Play Stats
    Inactive
    Quote Originally Posted by jharmison View Post
    If you have *nix (or whatever generic access to something BASH-like), you could install an MTA and do this:
    Made a little powershell script for people who don't have a Linux box -

    Code:
    $sound = new-Object System.Media.SoundPlayer;
    $webclient = New-Object System.Net.WebClient
    $webClient.DownloadFile("http://www.wavsource.com/snds_2017-07-30_6786517629734627/movies/star_wars/chewy.wav", "$pwd\upsound.wav")
    $sound.SoundLocation="$pwd\upsound.wav";
    
    while ($true) {
      $url = "https://www.swgemu.com/status/basilisk.xml"
      $contents = $webclient.DownloadString($url)
      $down = Select-String -Pattern "down" -InputObject $contents
      $up = Select-String -Pattern "up" -InputObject $contents
      $locked = Select-String -Pattern "lock" -InputObject $contents
    
      if ($up.length -gt 0) {
        Write-Host("The server is UP!")
        $sound.Play();
      }
      if ($down.length -gt 0) {
        Write-Host("The server is still down.")
      }
      if ($locked.length -gt 0) {
        Write-Host("The server is LOCKED, interesting...")
      }
      Start-Sleep -s 30
    }
    Downloads a chewy wav file, then checks every 30 seconds to see if it's up, down, or locked. If it's up it'll play the chewy sound (every 30 seconds). If you hit ctrl+c it'll end it.

    To use this just copy (ctrl+c) the code and open notepad. Paste it into notepad, then save that as "CheckSwg.ps1" (without the quotes) - you should save it to your documents or something. Can't just upload it somewhere for download, Windows will understandably complain if you download a powershell script and try to run it. Obviously run at your own risk, but you can clearly read what it's doing there.

    Then browse to wherever you saved it (preferably your Documents) and right click it, and click "Run With Powershell" and a window will open and start checking every 30 seconds.

    Edit: fixed a bug
    Last edited by spiceymeme; 08-11-2017 at 09:00 PM.

Thread Information

Users Browsing this Thread

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

     

Posting Permissions

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