The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

Server Restarter for Windows

 
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Getting Started
View previous topic :: View next topic  
Author Message
Br0k30n3



Joined: 30 Dec 2013
Posts: 15

PostPosted: Tue Dec 31, 2013 11:54 am    Post subject: Server Restarter for Windows Reply with quote

Been a long time. Nice to see some activity, even if it is just a little.
Jumping back on the saddle but running my dev server on on my windows box and I threw something together real quick that would restart the server
if it had crashed or I wanted to reboot.

I am sure that this could be a lot cleaner but it works, I might get around to cleaning it up.

This script is for PowerShell
Your can just open PowerShell_ISE.exe and created a new file. Save it in your c:\dawn folder.

Code:

do {
if (!(Get-Process -Name dawn.exe*)) {
   ' stopped at ' + (Get-Date) >> C:\dawn\dawnrb.log
    Set-Location C:\dawn
    C:\dawn\dawn.exe
    if (!(Get-Process -Name dawn.exe*)) {
   ' BAD Day ' + (Get-Date) >> C:\dawn\dawnrb.log
    $wshell = New-Object -ComObject Wscript.Shell -ErrorAction Stop
    $wshell.Popup("Something went horribly wrong",0,"Oh Noes!!!!!!!",16+0)
    exit
    }
}
start-sleep -seconds 10
} while ($true)


There are a few ways to execute this, I just right click it and Run Through PowerShell.

Be sure to edit seconds (default is 10) to how often you want it to check for the process.

You are going to need to create the C:\dawn\dawnrb.log file.

At the very least it is a starting point. If it proves to be helpful to anyone then I am happy.


::::: UPDATE :::::

This script is not working as it had originally, seems like I can't avoid adding a scheduled event task. I'll keep the code here for at least a
start point for someone who may want to tweak it. I will update this once I get the kinks worked out


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Getting Started All times are GMT + 13 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin