Make service/start/stop handle errors better. Resolve #2237.
This commit is contained in:
parent
1371226383
commit
dedb1b3d66
1 changed files with 25 additions and 10 deletions
|
|
@ -842,21 +842,30 @@ class CmdService(COMMAND_DEFAULT_CLASS):
|
||||||
return
|
return
|
||||||
if service.name[:7] == "Evennia":
|
if service.name[:7] == "Evennia":
|
||||||
if delmode:
|
if delmode:
|
||||||
caller.msg("You cannot remove a core Evennia service (named 'Evennia***').")
|
caller.msg("You cannot remove a core Evennia service (named 'Evennia*').")
|
||||||
return
|
return
|
||||||
string = "You seem to be shutting down a core Evennia service (named 'Evennia***'). Note that"
|
string = ("|RYou seem to be shutting down a core Evennia "
|
||||||
string += "stopping some TCP port services will *not* disconnect users *already*"
|
"service (named 'Evennia*').\nNote that stopping "
|
||||||
string += "connected on those ports, but *may* instead cause spurious errors for them. To "
|
"some TCP port services will *not* disconnect users "
|
||||||
string += "safely and permanently remove ports, change settings file and restart the server."
|
"*already* connected on those ports, but *may* "
|
||||||
|
"instead cause spurious errors for them.\nTo safely "
|
||||||
|
"and permanently remove ports, change settings file "
|
||||||
|
"and restart the server.|n\n")
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
||||||
if delmode:
|
if delmode:
|
||||||
service.stopService()
|
service.stopService()
|
||||||
service_collection.removeService(service)
|
service_collection.removeService(service)
|
||||||
caller.msg("Stopped and removed service '%s'." % self.args)
|
caller.msg("|gStopped and removed service '%s'.|n" % self.args)
|
||||||
else:
|
else:
|
||||||
service.stopService()
|
caller.msg(f"Stopping service '{self.args}'...")
|
||||||
caller.msg("Stopped service '%s'." % self.args)
|
try:
|
||||||
|
service.stopService()
|
||||||
|
except Exception as err:
|
||||||
|
caller.msg(f"|rErrors were reported when stopping this service{err}.\n"
|
||||||
|
"If there are remaining problems, try reloading "
|
||||||
|
"or rebooting the server.")
|
||||||
|
caller.msg("|g... Stopped service '%s'.|n" % self.args)
|
||||||
return
|
return
|
||||||
|
|
||||||
if switches[0] == "start":
|
if switches[0] == "start":
|
||||||
|
|
@ -864,8 +873,14 @@ class CmdService(COMMAND_DEFAULT_CLASS):
|
||||||
if service.running:
|
if service.running:
|
||||||
caller.msg("That service is already running.")
|
caller.msg("That service is already running.")
|
||||||
return
|
return
|
||||||
caller.msg("Starting service '%s'." % self.args)
|
caller.msg(f"Starting service '{self.args}' ...")
|
||||||
service.startService()
|
try:
|
||||||
|
service.startService()
|
||||||
|
except Exception as err:
|
||||||
|
caller.msg(f"|rErrors were reported when starting this service{err}.\n"
|
||||||
|
"If there are remaining problems, try reloading the server, changing the "
|
||||||
|
"settings if it's a non-standard service.|n")
|
||||||
|
caller.msg("|gService started.|n")
|
||||||
|
|
||||||
|
|
||||||
class CmdAbout(COMMAND_DEFAULT_CLASS):
|
class CmdAbout(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue