View previous topic :: View next topic |
Author |
Message |
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Mon Jun 30, 2008 19:08 Post subject: Another Reset Plugin Thread NWNX4 |
|
|
I have searched a number of threads related to this, but I am still not clear if there is a plugin for NWNX4 (windows) for a reset plugin.
Many of the posts I reviewed discuss options for NWNX but do not make it clear if it is for NWNX 2 or 4. I am unsure if a plugin for NWNX2 will also work for NWNX4...
Ideally (for me) this would be something that can be called from NWScript in the running module. It would also be wonderful if this simply caused the NWNX4 GUI to restart NWServer.
Sorry for adding another thread, but if someone could point me to the right place I would appreciate it. _________________ Lugoun
www.hotta-rpg.org |
|
Back to top |
|
|
Skywing
Joined: 03 Jan 2008 Posts: 321
|
Posted: Mon Jun 30, 2008 21:43 Post subject: |
|
|
You could use xp_spawn to launch nwn2srvutil -shutdown.
See http://www.nynaeve.net/Skywing/nwn2/nwn2srvutil.zip (src: http://www.nynaeve.net/Skywing/nwn2/nwn2srvutil_dist.zip)
... and the documentation: http://www.nynaeve.net/Skywing/nwn2/nwn2srvutil.txt
The -shutdown option should gracefully disconnect and save all players and then exit the nwn2server process. The NWNX4 watchdog will then restart it (assuming you have the process watchdog enabled).
Not entirely as clean as a dedicated plugin, but it should work.
(For what it's worth, we use a periodic task scheduler command to launch a batch file to run nwn2srvutil -shutdown for our scheduled shutdowns. If you need something that's on-demand and not just a regular occurance then perhaps launching nwn2srvutil from xp_spawn is the best option. That is until if/when someone makes a dedicated plugin for it, but it doesn't seem too compelling as I believe this ought to work well enough.)
N.B. If you are running >1 nwn2server instance on the same computer, this trick won't work as nwn2srvutil will require that the nwn2server pid be specified to it due to an ambiguouity. |
|
Back to top |
|
|
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Tue Jul 01, 2008 7:16 Post subject: |
|
|
Thanks Skywing. I'll check it out. Yours was one of the options I read in another thread that looked interesting (I think the 'graceful' part!).
Primarily we are looking for something that can do a daily scheduled restart of NWServer, although an on demand DM tool to reboot would be desirable too, for when there are DM's but no server admins.
I'll have to see if anyone in our group is familiar with task schedulers, etc.
Can you explain what is meant in the documentation by:
"you must have both nwn2srvutil.exe and nwn2srvutil_remote.dll in the current directory".
I'm not sure what is meant by "the current directory".
Thanks, _________________ Lugoun
www.hotta-rpg.org |
|
Back to top |
|
|
Skywing
Joined: 03 Jan 2008 Posts: 321
|
Posted: Tue Jul 01, 2008 17:19 Post subject: |
|
|
That means that the directory where you launch nwn2sruvtil.exe should have nwn2srvutil_remote.dll present in it.
For example, one possibility might be the following as a batch file, assuming that there's a directory "C:\nwn2srvutil" where nwn2srvutil.exe and nwn2srvutil_remote.dll are present at:
Code: | cd c:\nwn2srvutil
nwn2srvutil.exe -shutdown |
Assuming you have a batch script named, say, "restart.bat" saved at C:\nwn2srvutil\restart.bat, one could open a cmd instance as an administrator and issue, say, the following:
at 06:00 /every:monday,wednesday,friday "C:\nwn2srvutil\restart.bat"
... which would schedule this to run and restart the server at 6am server time every Monday, Wednesay, Friday.
You could also do something more fancy, such as the following, which allows you to, say, create a file on disk ("C:\nwn2srvutil\block_autorestart.txt" in this case, contents don't matter) to keep the scheduler jobs intact but temporarily turn off autorestarts (say you have a DM event in progress that created a bunch of NPCs that you don't want to have to remake after a restart, or something of the sort). This example also logs the timestamp of the last attempted restart to a log file as well. In order to re-enable autorestarts on this, you would just delete c:\nwn2srvutil\block_autorestart.txt.
Code: | if exist C:\nwn2srvutil\block_autorestart.txt ( goto :EOF )
cd c:\nwn2srvutil
nwn2srvutil.exe -shutdown
echo "Restarted nwn2 at %DATE% %TIME%" > C:\nwn2srvutil\lastrestart.log |
Then, you could also get somewhat fancier and, say, provide a five minute warning:
Code: | if exist C:\nwn2srvutil\block_autorestart.txt ( goto :EOF )
cd c:\nwn2srvutil
nwn2srvutil.exe -msg "Warning: Server restarting in 5 minutes." |
...name this, say, c:\nwn2srvutil\5min_warning.bat, then schedule it like so:
at 05:55 /every:monday,wednesday,friday "C:\nwn2srvutil\5min_warning.bat"
N.B. Don't try to run multiple nwn2srvutil instances from the same batch script simultaneously, instead, combine all requests on the same command line or you may have requests get dropped. This is a limitation of the way in which nwn2srvutil injects itself into the server process.
N.B.2: Typically not worth trying to send a message in the same instant that the server is getting restarted as the player GUI will shut down before it is displayed to the user anyway. |
|
Back to top |
|
|
Elrahc
Joined: 30 Jan 2007 Posts: 10
|
Posted: Sat Oct 25, 2008 1:01 Post subject: |
|
|
Such a sexy application...
~Elrahc |
|
Back to top |
|
|
TroveLord
Joined: 22 Nov 2006 Posts: 136 Location: Italy
|
Posted: Sat Oct 25, 2008 1:09 Post subject: |
|
|
I use a far simpler way.
TASKKILL /F nwn2server.exe |
|
Back to top |
|
|
Elrahc
Joined: 30 Jan 2007 Posts: 10
|
Posted: Sat Oct 25, 2008 1:14 Post subject: |
|
|
My excitement is due to the fact I can message the people playing that a server restart is coming, all automated.
~Elrahc |
|
Back to top |
|
|
TroveLord
Joined: 22 Nov 2006 Posts: 136 Location: Italy
|
Posted: Sat Oct 25, 2008 1:19 Post subject: |
|
|
Use a delay command. |
|
Back to top |
|
|
|