EOSERV Forum > EO Server Building > Universal Server-Restarter
Page: << 1 >>
Universal Server-Restarter
Author Message
Post #204753 Universal Server-Restarter

just something i made while messing around with batch files figured it was a pretty interesting improvement on the basic server re-starter batch files i configured it to launch eosources gui and console as well as eoserv's console all from 1 file, if you find it helpful then great it was just a for shits and giggles thing i made just to see if i could, just place the batch file in the main folder so it works correctly

Download Link

5 years, 9 weeks ago
Post #204754 Re: Universal Server-Restarter

This is what your restarter contains:

@ECHO OFF
CLS
ECHO 1.EOSource GUI-Restarter
ECHO 2.EOSource Console-Restarter
ECHO 3.EOServ Console-Restarter
ECHO 4.Quit
ECHO.

CHOICE /C 1234 /M "Enter your choice:"

:: Note - list ERRORLEVELS in decreasing order
IF ERRORLEVEL 4 GOTO End
IF ERRORLEVEL 3 GOTO c
IF ERRORLEVEL 2 GOTO b
IF ERRORLEVEL 1 GOTO a

:a
ECHO EOSource GUI-Restarter
<NUL set /P "=Checking Server Host, Please wait"
ping 127.0.0.1 -n 3 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
ECHO.
ping 127.0.0.1 -n 3 >nul
ECHO Server Online
start /wait /min EOSourceGUI.exe
ECHO Server Offline
ECHO Time Of Crash %time%
ECHO Server Rebooting
GOTO a

:b
ECHO EOSource Console-Restarter
<NUL set /P "=Checking Server Host, Please wait"
ping 127.0.0.1 -n 3 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
ECHO.
ping 127.0.0.1 -n 3 >nul
ECHO Server Online
start /wait /min EOSource.exe
ECHO Server Offline
ECHO Time Of Crash %time%
ECHO Server Rebooting
GOTO b

:c
ECHO EOServ Console-Restarter
<NUL set /P "=Checking Server Host, Please wait"
ping 127.0.0.1 -n 3 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
<NUL set /P "=."
ping 127.0.0.1 -n 2 >nul
ECHO.
ping 127.0.0.1 -n 3 >nul
ECHO Server Online
start /wait /min eoserv.exe
ECHO Server Offline
ECHO Time Of Crash %time%
ECHO Server Rebooting
GOTO c

:End
pause

And this is all you really need:

@echo off
cls
:start
c:\directory\program.exe
goto start

Also, don't put files on stupid services with clickbait pop-ups to fix your PC. This could be crammed into a pastebin or even GitHub although I don't think it is worthy of the latter. As far as crash time that you plugged in, EOSERV has an error log that would make this feature redundant. Batch files are simple text files saved with a .bat file extension and can be edited by the end user to suit them. If your batch file was loaded to start with PC, it would fail to restart the server due to waiting for software selection. The example I gave requires the end user to edit the directory and program, but will not fail if set to start with PC boot. My example uses 114 bytes of hard disk space as opposed to your 1.91kb. Bigger isn't always better.

5 years, 9 weeks ago
Post #204755 Re: Universal Server-Restarter

This is kinda cool.. thanks for the release!


As for the click bait website Apollo is on about.. mediators is absolutely fine! One of the biggest file host sites and you’d need to be an utter tool to click one of the ads (Apollo?) but if it is as big of an issue as Apollo made it out to be, I’ll happily host the text for you on my site!

5 years, 9 weeks ago
Post #204756 Re: Universal Server-Restarter

Both these batch files assume that if the server breaks the process will end. There could be a situation where the server hangs/becomes unresponsive. A Simple solution to this, for Windows, would be to modify the server to call the RegisterApplicationRestart() API at startup.

EDIT: This is also recommended because of how Windows likes to update and restart itself unsupervised.

EDIT EDIT: I knocked up a quick and simple Pascal example of how this API works: http://sordie.co.uk/viewcode?CrashRestartDemo

---
http://sordie.co.uk
http://twitter.com/@SordieEO
5 years, 9 weeks ago
Post #204757 Re: Universal Server-Restarter

@Callum: His batch file demands a user input and cannot work after a PC reboot. Also, there are probably a million examples of the same thing across the internet in text form. There are people that fall for "fix your PC now" clickbait. If not it wouldn't be a thing in 2019.

@Sordie, I have never seen EOSERV hang outside of the early quest engine that did not have recursion checks which in turn created infinity loops. However, end-user hacking may end up in a scenario just as you suggest as I have seen several posts regarding recent custom builds that have broken things which were working properly in a vanilla build. I used a remote task kill tool in the early days when EOSERV was unresponsive, but I have not needed that in years. Not suggesting it is impossible, but highly unlikely.

5 years, 9 weeks ago
Post #204758 Re: Universal Server-Restarter

@Apollo Take a look at that batch file. These are the same people customising EOSERV. Do you think every server is pure SausageCode(tm) incapable of spin? XD

 

---
http://sordie.co.uk
http://twitter.com/@SordieEO
5 years, 9 weeks ago
Post #204759 Re: Universal Server-Restarter

EOSERV vanilla, even pure Sausage code can lock as you say under the conditions of using SQLite and having a rather large database, however the point I was making is the majority of these custom servers borrow existing Sausage code to change a few variables and make something totally hacky. The largest threat is calling variables that do not exist within the container which results in that well known Segmentation Fault error that is impossible to diagnose. Chances are if they borrow a function from existing code they will likely determine very quickly if they have created such a soft-locking infinity loop. I am fairly certain that utterly dangerous word “goto” may no longer exist in EOSERV. Again, not ruling out soft-locking as a possibility, but on the very unlikely end of the spectrum. 

5 years, 9 weeks ago
Post #204761 Re: Universal Server-Restarter

I apologise for this post in advance. I'm at work and haven't spoken to another human being in hours so I'm getting kinda needy of interaction XD Here we go...

Apollo posted: (25th Feb 2019, 12:10 pm)

@Sordie, I have never seen EOSERV hang outside of the early quest engine

and

Apollo posted: (26th Feb 2019, 04:27 pm)

EOSERV vanilla, even pure Sausage code can lock as you say

Normally I'm the one that gets accused of sending out mixed messages. Are you accidentally reading my lines from the script? XD

I wanted to like/+1 your last post as social media has trained me to do so but I guess I lost that ability when I stopped being a mod here. =P

Apollo posted: (24th Feb 2019, 12:19 pm)

 My example uses 114 bytes of hard disk space as opposed to your 1.91kb. Bigger isn't always better.

[insert lame bigger being better joke here] but restart.bat:

s:
%*
goto s

Run with: restart.bat \path\to\server.exe

14 bytes. Anyone want to try smaller? ;]

---
http://sordie.co.uk
http://twitter.com/@SordieEO
5 years, 9 weeks ago
Post #204762 Re: Universal Server-Restarter

I always enjoying reading all of these comments :D Always like the fact that there are still people lurking about on here!


5 years, 9 weeks ago
Post #204763 Re: Universal Server-Restarter
Sordie posted: (27th Feb 2019, 10:31 am)

I apologise for this post in advance. I'm at work and haven't spoken to another human being in hours so I'm getting kinda needy of interaction XD Here we go...

Apollo posted: (25th Feb 2019, 12:10 pm)

@Sordie, I have never seen EOSERV hang outside of the early quest engine

and

Apollo posted: (26th Feb 2019, 04:27 pm)

EOSERV vanilla, even pure Sausage code can lock as you say

Normally I'm the one that gets accused of sending out mixed messages. Are you accidentally reading my lines from the script? XD

I wanted to like/+1 your last post as social media has trained me to do so but I guess I lost that ability when I stopped being a mod here. =P

Apollo posted: (24th Feb 2019, 12:19 pm)

 My example uses 114 bytes of hard disk space as opposed to your 1.91kb. Bigger isn't always better.

[insert lame bigger being better joke here] but restart.bat:

s:
%*
goto s

Run with: restart.bat \path\to\server.exe

14 bytes. Anyone want to try smaller? ;]


Well Sausage is aware of SQLite soft-locking, but it probably won't get fixed. I recommend MariaDB only. But otherwise, there is no soft-lock.
5 years, 9 weeks ago
Post #204764 Re: Universal Server-Restarter
Sordie posted: (27th Feb 2019, 10:31 am)

restart.bat:

s:
%*
goto s

Run with: restart.bat \path\to\server.exe

14 bytes. Anyone want to try smaller? ;]


No takers? OK... tiny_restart.bat:
%*||%0 %*

9 bytes and has the feature that it will only restart if the server crashes. If the server closes normally it will stop. Change || to a new line if you want it to always restart.

Run with: tiny_restart.bat \path\to\server.exe

(And It's dangerously close to being a fork bomb! XD Replace || with | and watch your machine die!)

Yeah. It's been one of those days.


---
http://sordie.co.uk
http://twitter.com/@SordieEO
5 years, 9 weeks ago
Post #204780 Re: Universal Server-Restarter
Sordie posted: (27th Feb 2019, 06:56 pm)

Sordie posted: (27th Feb 2019, 10:31 am)

restart.bat:

s:
%*
goto s

Run with: restart.bat \path\to\server.exe

14 bytes. Anyone want to try smaller? ;]


No takers? OK... tiny_restart.bat:
%*||%0 %*

9 bytes and has the feature that it will only restart if the server crashes. If the server closes normally it will stop. Change || to a new line if you want it to always restart.

Run with: tiny_restart.bat \path\to\server.exe

(And It's dangerously close to being a fork bomb! XD Replace || with | and watch your machine die!)

Yeah. It's been one of those days.



Thanks Sordie!!! I can finally run eosource on my 56K RAM corded phone without worrying about it crashing :D

Ah the days when I had 256MB of RAM and was able to run this long [related to mule] batch script.

https://github.com/CanIGetaPR/ServerCrashRestarter

Maybe this advanced restarter script will help someone, as it logs the time the server crashed at and keeps track of the number of crashes. Originally made it for my friend whose server would crash and then hang as windows waited for him to click an OK button to close the program haha. (surprisingly stopping windows error reporting didnt help or he couldnt disable that but oh well this was created with enthusiasm)
---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
5 years, 7 weeks ago
Post #204782 Re: Universal Server-Restarter
Apollo posted: (25th Feb 2019, 12:10 pm)

@Callum: His batch file demands a user input and cannot work after a PC reboot. Also, there are probably a million examples of the same thing across the internet in text form. There are people that fall for "fix your PC now" clickbait. If not it wouldn't be a thing in 2019.

@Sordie, I have never seen EOSERV hang outside of the early quest engine that did not have recursion checks which in turn created infinity loops. However, end-user hacking may end up in a scenario just as you suggest as I have seen several posts regarding recent custom builds that have broken things which were working properly in a vanilla build. I used a remote task kill tool in the early days when EOSERV was unresponsive, but I have not needed that in years. Not suggesting it is impossible, but highly unlikely.


o.o' after the first initial user input the script just repeats your last selection it never returns to the first menu as for the length... yea sure i could have made it smaller and just skipped the eyecandy but i figured it added a little flair to the sequence with increasing dots every second the ping timeout waited so there wasn't a conflict between the last server closing and the next one opening o.o'

i get it your insulted that i didn't make eoserv the 1st option but that's just how i ended up adding em in XD

also my bad bout the link o.o' mediafire never had popups far as i used it o.o' guess i could have just thrown it in pastebin but it didn't occur to me at the moment
5 years, 6 weeks ago
Post #204785 Re: Universal Server-Restarter
judess69er posted: (14th Mar 2019, 07:18 am)

Apollo posted: (25th Feb 2019, 12:10 pm)

@Callum: His batch file demands a user input and cannot work after a PC reboot. Also, there are probably a million examples of the same thing across the internet in text form. There are people that fall for "fix your PC now" clickbait. If not it wouldn't be a thing in 2019.

@Sordie, I have never seen EOSERV hang outside of the early quest engine that did not have recursion checks which in turn created infinity loops. However, end-user hacking may end up in a scenario just as you suggest as I have seen several posts regarding recent custom builds that have broken things which were working properly in a vanilla build. I used a remote task kill tool in the early days when EOSERV was unresponsive, but I have not needed that in years. Not suggesting it is impossible, but highly unlikely.


o.o' after the first initial user input the script just repeats your last selection it never returns to the first menu as for the length... yea sure i could have made it smaller and just skipped the eyecandy but i figured it added a little flair to the sequence with increasing dots every second the ping timeout waited so there wasn't a conflict between the last server closing and the next one opening o.o'

i get it your insulted that i didn't make eoserv the 1st option but that's just how i ended up adding em in XD

also my bad bout the link o.o' mediafire never had popups far as i used it o.o' guess i could have just thrown it in pastebin but it didn't occur to me at the moment

I think you missed the part where I said after a PC reboot. The batch file will always start from the beginning.
5 years, 6 weeks ago
Page: << 1 >>

EOSERV Forum > EO Server Building > Universal Server-Restarter