View previous topic :: View next topic |
Author |
Message |
william_hunter
Joined: 31 Jan 2007 Posts: 149
|
Posted: Sun Mar 18, 2007 14:56 Post subject: Shell scripting and me |
|
|
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 |
|
|
wmbc9040op
Joined: 10 Mar 2007 Posts: 6
|
Posted: Wed Mar 21, 2007 4:19 Post subject: |
|
|
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 |
|
|
william_hunter
Joined: 31 Jan 2007 Posts: 149
|
Posted: Wed Mar 21, 2007 13:29 Post subject: |
|
|
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 |
|
|
william_hunter
Joined: 31 Jan 2007 Posts: 149
|
Posted: Thu Mar 22, 2007 4:12 Post subject: |
|
|
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 |
|
|
wmbc9040op
Joined: 10 Mar 2007 Posts: 6
|
Posted: Thu Mar 22, 2007 16:38 Post subject: |
|
|
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 |
|
|
william_hunter
Joined: 31 Jan 2007 Posts: 149
|
Posted: Fri Mar 23, 2007 2:23 Post subject: |
|
|
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 |
|
|
wmbc9040op
Joined: 10 Mar 2007 Posts: 6
|
Posted: Fri Mar 23, 2007 3:15 Post subject: |
|
|
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 |
|
|
william_hunter
Joined: 31 Jan 2007 Posts: 149
|
Posted: Fri Mar 23, 2007 17:21 Post subject: |
|
|
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 |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Sat May 05, 2007 9:54 Post subject: |
|
|
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 |
|
|
william_hunter
Joined: 31 Jan 2007 Posts: 149
|
Posted: Sun May 06, 2007 0:15 Post subject: |
|
|
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 |
|
|
|