logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Shell scripting and me

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support
View previous topic :: View next topic  
Author Message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Sun Mar 18, 2007 14:56    Post subject: Shell scripting and me Reply with quote

I am having a terrible time getting my server to restart after a crash or after calling reset. I have tried a variety of shell scripts and nothing seems to work. Can someone give me a complete shell script that fires up NWNx and then makes sure the server instance restarts when it goes down? This is very frustrating to me. I keep thinking I have it right and then...nothing..

Yes, I know I should just learn shell scripting, but my time is being consumed right now by life. I just don't have time right now.
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
wmbc9040op



Joined: 10 Mar 2007
Posts: 6

PostPosted: Wed Mar 21, 2007 4:19    Post subject: Reply with quote

Hi,

You can try this script as a start. It is a small script called nwnkicker.sh my husband wrote for me around the nwnstartup.sh script. The script will need to be executable of course and any paths changed to meet your needs.
This is simple and could use modifications. As it is you should run it in screen and then detach the screen session. When I want to end the server I reattach to the screen session issue an exit and hit control-c after the "nwn server exited..." is printed but before the server restarts.



#!/bin/sh
echo "Starting the nwn server for the first time..."
while ( true )
do
echo "Restarting the nwn server..."
/opt/nwn/nwnstartup.sh
echo "nwn server exited..."
sleep 5
done
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Wed Mar 21, 2007 13:29    Post subject: Reply with quote

Ah, so you actually call the nwnstartup.sh...sadly I never thought to do that. This makes sense to me now. Thanks.
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Thu Mar 22, 2007 4:12    Post subject: Reply with quote

Alright, so I am running the server on the above named script, but it seems the reset plugin is not fully killing the server process when reset is called. It shuts down but remains in the running processes list of the machine...any insights on that anyone?
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
wmbc9040op



Joined: 10 Mar 2007
Posts: 6

PostPosted: Thu Mar 22, 2007 16:38    Post subject: Reply with quote

I'm not sure. When I use the reset plugin with the script above the reset plugin kills the server and the script reloads the server. Is yours behaving differently or did you expect different behavior?

The script is restarting the server, that may be why you see a running process.
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Fri Mar 23, 2007 2:23    Post subject: Reply with quote

If the shell script is rebooting nwserver, something is not working right, because the mod isnt loading..it works fine the first time, but when I call reset, it shuts down and does not return, even though the nwserver process is running.
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
wmbc9040op



Joined: 10 Mar 2007
Posts: 6

PostPosted: Fri Mar 23, 2007 3:15    Post subject: Reply with quote

ok. I don't have the first line in my script.
Would you mind removing the #!/bin/sh from your nwnkicker.sh
Did you change the path for nwnstartup.sh in the script if needed?

Where is your nwserver installed, as well as the nwnstartup.sh script, and the nwnkicker script? Are they all in the same directory?

I take it the reset plugin works correctly when you do not use the nwnkicker.sh script? i.e. the server exits but does not restart.
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Fri Mar 23, 2007 17:21    Post subject: Reply with quote

wmbc9040op wrote:
ok. I don't have the first line in my script.
Would you mind removing the #!/bin/sh from your nwnkicker.sh


What do you mean by this? I can remove that line, yes..

Quote:

Did you change the path for nwnstartup.sh in the script if needed?


I changed the path to reflect where nwnstartup.sh is. I don't think the initial boot would occur if I hadnt, right?

Quote:

Where is your nwserver installed, as well as the nwnstartup.sh script, and the nwnkicker script? Are they all in the same directory?

Yes. All are in the same dir.

Quote:

I take it the reset plugin works correctly when you do not use the nwnkicker.sh script? i.e. the server exits but does not restart.


yes, the reset plugin kills the server when I start the server directly from nwnstartup.sh
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Sat May 05, 2007 9:54    Post subject: Reply with quote

The server not exiting fully is a known bug in relation to NWNX, that I dont have the details on.

You can work around it by tail'ing the nwserver log file and kill -9 the server when it says "Server exiting".
Back to top
View user's profile Send private message
william_hunter



Joined: 31 Jan 2007
Posts: 149

PostPosted: Sun May 06, 2007 0:15    Post subject: Reply with quote

I really need to learn more about linux....I have no idea what that means (*grins sheepishly*)
_________________
The Realm of Tharagon NWN PW
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group