Way to check status of the server with a script?

Hi there,
I’m looking at putting together an init.d script to automagically have my server get going, and I am wondering: beyond simply checking that the process is running in ps x is there a check that the server is indeed up and running?
Using devuan linux if it matters.

  • May

Put what I have for the unit file up here, in case anyone’s interested, though I’d like to have some better checks it hasn’t derped:
https://neverwintervault.org/project/nwn1/other/sysvinit-unit-file-nwn-1-dedicated-server

That said, the perfect is the enemy of the good, as they say, so that’s what I have right now.

Invoking screen though script is hit or miss for me, especially reattach, and my dev env is pretty close to server (what works for me doesn’t work on server and vice versa).

Don’t remember how many notes clippy made, but his barebones server control scripts are at https://github.com/mtijanic/nwn-misc/tree/master/nwnx-server-setup Multiplexing is always cool, but if it’s way more hassle than control scripts that stay in userland and being able to just dump stdout to file :slight_smile:

The thing to understand is two-fold: first, if you try to invoke it through crontab (ie, @reboot etc), the services that screen need are unlikely to be available until you’re in multi-user mode (runlevel 2 or 5), so it’s not really going to work. Second, if you want to pass parameters as I do, you need to export them so that the child shells will inherit the parameters; otherwise they lose everything except PATH and a couple other things.

It works well enough now and is pretty reliable (in my setup anyways, anything outside of devuan chimaera, I haven’t tested), though I do want to include some more reporting in the Status option, it’ll let me keep a better eye on things.

[edit]: I should note this is for the vanilla nwserver-linux server, not nwnx