SphereCommunity
f_OnServerExit restart SphereSvr using SYSSPAWN - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: f_OnServerExit restart SphereSvr using SYSSPAWN (/Thread-f-OnServerExit-restart-SphereSvr-using-SYSSPAWN)



f_OnServerExit restart SphereSvr using SYSSPAWN - PePs1Man - 07-02-2017 05:18 AM

Hello,

I made my sphere restart on server exit.

However, it seems that sphere is not exited when sphere exits because when the new instance is run, Server is terminated with error -9 (unable to bind socket).

So, is there a way better to do it in 56c? or I must create a batch file ? Smile

Just asking...

Code:
[DEFNAME Server_Global]
SERVUID                    0DE7F // uid of a plevel 7 character

[FUNCTION f_onserver_exit]
LOCAL.OLDOBJ <OBJ.UID>
OBJ <SERV.DEF.SERVUID>
OBJ.STARTSPHERE
OBJ <LOCAL.OLDOBJ>

[FUNCTION STARTSPHERE]
Local.Restart <sysspawn <serv.def.SphereSvr>>
Credit: Code to Ben(Axis II dev)

Sphere Version 0.56c-Release [WIN32] by http://www.spherecommunity.net, compiled at Apr 10 2016 (16:50:52) [build 2807 / GIT hash 0dc0ebf]


RE: f_OnServerExit restart SphereSvr using SYSSPAWN - Kanibal - 07-04-2017 04:13 AM

Bat file:
Code:
:run
start /wait spheresvr.exe
goto run



RE: f_OnServerExit restart SphereSvr using SYSSPAWN - Ben - 07-04-2017 05:40 AM

The reason for this is that it starts the new server before the old one has time to fully shutdown.
Kanibal probably has the simplest way to deal with this.
Run the Bat file written there and sphere will start again if it shuts down.
There is also a program called sphereservice in the downloads section for this purpose too.