Forum OpenACS Development: NaviServer on Windows: How to restart on Windows? How to exit with error code?


We've got an issue on Windows with the restart function of NaviServer / AOLserver:

- ns_shutdown actually behaves correctly. It shuts down the server with a zero(?) error code indicating correct behavior.

There is an option in Windows to automatically restart a service (first error, second error, consecutive errors). However, this only works in case of an error.

In order to use this functionality, we'd have to ns_shutdown NaviServer with an error code.

Maybe there is some hidden "ns_abort" function or some other possibility to quit NaviServer and to return an error code?

Do you see any alternatives? Maybe let the server kill itself?

We've got a "service monitor" process running that actually monitors the status of the service. However, not all users will actually run this service, so I'd prefer to use the Windows built-in option...


You might try "ns_shutdown -restart" ...
Hi Gustaf,

Great! And it works works on Windows.

However, I'd have to patch /acs-admin/server-restart then.

Would it be an option to include the -restart parameter for the next OpenACS version?

I checked the rest of the code. This was the only use of ns_shutdown, except for the bootstrap installer. Are you aware of any other use I might have missed?


You are asking for a change, which is
a) incompatible with AOLserver, and
b) can break existing installations , when suddenly nsd returns on restart a non-zero return code, when someone click on "restart server". The exact consequences for the various service managers (like systemd, upstart, daemontools, launchd, ...) etc. are hard to determine and depend on details.

Leaving the default behavior as it is and add a configure option for NaviServer and the non-zero returncode is probably ok.

Hi Gustaf,

Good points.
So yeah, a configuration option would be great in one of the next OpenACS options.

Meanwhile we've patched the code in OpenACS 5.9 to do the -restart on Windows. There is no time pressure, because it will probably be years before we do the next update.