Author Topic: Request: Linux NWNW2 help  (Read 595 times)

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Request: Linux NWNW2 help
« on: June 23, 2012, 12:46:20 am »


               1. Does anyone have a way to launch nwnx2 on reboot of ubuntu server? Normally when I restart my server I
start a new screen
cd/nordock/awakening
 ./nwnstartup.sh
detach from the screen 
log out

But I am new to Linux and not sure how to add a startup script. 

2. I am looking for a way from in game to activate my nwnx2 restart script. Normally from the command line I
screen -x
exit
This would on shut down fire my startup script but I am looking for the best way to do this from in game.


Thanks so much!
               
               

               
            

Legacy_Soleares

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #1 on: June 23, 2012, 04:19:11 pm »


               You're better off actually posting this in the NWN2 forums. Just above the NWN1 forums.

http://social.biowar.../1/subindex/156
               
               

               
            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #2 on: June 23, 2012, 07:19:33 pm »


               Sorry for the confusion but I need help with nwnx2 which Is the version that works on nwn1.
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #3 on: June 23, 2012, 10:06:40 pm »


               yeah, smith is in the right forum.

i have a similar setup - i run nwnstartup.sh from a screen session.  here's how i do it from boot:

 
su - nwn -c "/nwn/dalakora/start-startup > /tmp/logfile" &

 
so that it runs as user "nwn".

then, i have for "start-startup":

 
screen -A -d -m -S nwn1 ./wrapper.sh

 

the "-d" makes it launch in detached mode (because there will be no tty associated with it at boot time).

and then my wrapper script just starts my nwnstartup.sh.


honestly though, i think that startup script has only run like once or twice.  the linux server jsut doesn't crash:

[nwn@dalakora dalakora]$ uptime
16:06:19 up 731 days, 22:40,  3 users,  load average: 1.74, 1.57, 1.52


               
               

               


                     Modifié par acomputerdood, 23 juin 2012 - 09:09 .
                     
                  


            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #4 on: June 24, 2012, 09:09:42 pm »


               Thanks for the help Dood, one question I have is where do you place the first line of code

screen -A -d -m -S nwn1 ./wrapper.sh

so that it executes on boot?
               
               

               
            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #5 on: June 24, 2012, 10:57:52 pm »


               Okay, I got the script to fire at boot by following the instructions here.
http://jonathonhill....-ubuntu-server/
At least I believe it is working as it was posting to log.boot with an error until I fixed it.

But the other scripts are not working. Here is what I have

awakening_on_boot.sh:
su - awakening -c "/nordock/awakening/start-startup > /tmp/logfile" &

start-startup.sh (located at /nordock/awakening/start-startup.sh)
screen -A -d -m -S nwn1 ./wrapper.sh

wrapper.sh (located at /nordock/awakening/wrapper.sh)
./nwnstartup.sh

But when I look for a screen in terminal it does not find any.
               
               

               


                     Modifié par nwnsmith, 24 juin 2012 - 09:58 .
                     
                  


            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #6 on: June 25, 2012, 12:12:18 am »


               

nwnsmith wrote...

Okay, I got the script to fire at boot by following the instructions here.
http://jonathonhill....-ubuntu-server/
At least I believe it is working as it was posting to log.boot with an error until I fixed it.


great!

But the other scripts are not working. Here is what I have


'<img'>

awakening_on_boot.sh:
su - awakening -c "/nordock/awakening/start-startup > /tmp/logfile" &

start-startup.sh (located at /nordock/awakening/start-startup.sh)
screen -A -d -m -S nwn1 ./wrapper.sh


i'm guessing that this is the problem right here.  your "awakening_on_boot.sh tries to run the command "start-startup" but your screen is launched from a file called "start-startup.sh".  they're not the same thing.  you'll either have to modify the "awakening_on_boot.sh" to launch "start-startup.sh" or change the name of "start-startup.sh" to be "start-startup".

if you do a:

$ cat /tmp/logfile

(where "$" is the system prompt, not something you type in) it should give a clue as to what the problem was.
               
               

               
            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #7 on: June 25, 2012, 12:36:40 am »


               I made the change to call start-startup.sh but still no dice. the log file is blank as well.

Thanks for any help!
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
Request: Linux NWNW2 help
« Reply #8 on: June 25, 2012, 10:45:37 am »


               did a little testing, and reworked my scripts for ubuntu.  either ubuntu does things a little differently, or my system is just really old and not running the same versions or whatever.  anyway, here it goes:

awakening_on_boot.sh:

#!/bin/sh
sudo -u awakening -c "/nordock/awakening/start-startup" &

ubuntu didn't like using "su" and prefers sudo instead, and then it was choking on my earlier use of "> /tmp/logfile" redirect.

start-startup.sh:

#!/bin/sh
screen -A -d -m -S awakening1 bash -c '/nordock/awakening/wrapper.sh; exec bash'


screen wanted the command run in a shell, which i'm a little confused about because wrapper.sh should already have been launching it in a shell.  but i digress and bear with me here.

wrapper.sh:

#!/bin/sh

while true
do
/nordock/awakening/nwnstartup.sh
done

this puts your nwnstartup.sh into a while loop, meaning you can kill the nwn server and it will automatically restart it when it dies.  your can remove the while loop if you want it to die and stay dead.

then, just make sure you have done a "chmod 755" on all the files to make them executable.
               
               

               


                     Modifié par acomputerdood, 25 juin 2012 - 09:46 .