Author Topic: Linux boot script question?  (Read 2022 times)

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Linux boot script question?
« on: February 28, 2011, 01:37:12 am »


               I have installed my mod on linux server and wanted a script to make sure it is running .This one checks every minute and if not it starts it.
I have 2 questions ...

1.Will linux read my nwnplayer.ini settings so I dont have to put in script?

2.Dont I have to make sure this line is in the script?  export LD_LIBRARY_PATH=./miles:$LD_LIBRARY_PATH

Script::::::

#!/bin/bash
# NWN Server Process Monitor
#Get in the right directory
NWN_DIR=/home/georage/NWN
cd $NWN_DIR
# Command to run
RESTART="./nwserver -module mine2keep"
#path to pgrep command
PGREP="/usr/bin/pgrep"
# daemon name
HTTPD="nwserver"
# find pid
$PGREP ${HTTPD}
if [ $? -ne 0 ] # if not running
then
 # restart
 $RESTART
fi



this is where I got the script from ::::

http://nwn.bioware.c...&forum=56&sp=75
               
               

               
            

Legacy_Skildron

  • Sr. Member
  • ****
  • Posts: 421
  • Karma: +0/-0
Linux boot script question?
« Reply #1 on: February 28, 2011, 11:50:17 am »


               I just tried it: Yes, your nwnplayer.ini will be loaded and the settings used. nwserver won't even start up correctly if nwn.ini and nwnplayer.ini are not present.

And no, the LD_LIBRARY_PATH settings are only necessary for nwmain (the nwn linux client), because they point to the miles shared objects that are needed for audio output.

HTH
Greetings
Skildron
               
               

               


                     Modifié par Skildron, 28 février 2011 - 11:53 .
                     
                  


            

Legacy_Skildron

  • Sr. Member
  • ****
  • Posts: 421
  • Karma: +0/-0
Linux boot script question?
« Reply #2 on: February 28, 2011, 05:18:35 pm »


               By the way, in the thread you got your script from, there are a lot of more sophisticated solutions. I especially like this one. See this thread on instructions how to use it.

Greetings
Skildron
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Linux boot script question?
« Reply #3 on: February 28, 2011, 09:54:34 pm »


               Ahh thank you very much for your input .Your answers have added many missing peices to the puzzle for me. I am no scripter or linux person but with the help from this community and the content people haved created and shared ..I have my project on the run.Thanks again Skildron
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Linux boot script question?
« Reply #4 on: March 01, 2011, 04:20:12 am »


               The script skil posted is a good one, as a note the default buffer size in most linux installs is only 8192 bytes, so the line
CATCH_OUTPUT="empty -r -t 30 -b 2048000 -i out.fifo"

you should probably change that value to 8192 unless you want to rebuild the kernel yourself.  (though I see Skil linked to my post on it)

The only part I had issue with was the password removal, never could get the line:

WAIT_LOADED="empty -w -t $SECONDS_TO_WAIT -i out.fifo -o in.fifo $PASS_PHRASE" # FOR nwnstartup.sh

to work satisfactorily.  Maybe Skil can provide insight, the script is infinitely more powerful and useful than the basic one you had.
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Linux boot script question?
« Reply #5 on: March 01, 2011, 06:07:19 pm »


               Thanks guys ...right now Im having a problem lauching manually to test.
Im in the directory   /home/dan/nwn    then I type   ./nwserver -module "my_mod _name_here"  and get  no such file or directory found for nwserver ???When I run ./fixinstall it works and says ready to run so what is the issue?
               
               

               
            

Legacy_Skildron

  • Sr. Member
  • ****
  • Posts: 421
  • Karma: +0/-0
Linux boot script question?
« Reply #6 on: March 01, 2011, 08:00:04 pm »


               And nwserver really is located in that directory and has the executable bit set? AFAIKS fixinstall only checks for nwn and nwmain, not for nwserver!

HTH
Greetings
Skildron
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Linux boot script question?
« Reply #7 on: March 01, 2011, 08:14:00 pm »


               The linux nwserver is in that directory .Not the nwserver.exe  
Not sure what you mean by bit set?
Sorry total noob with linux...here is my skill level.
I turned on server Ubuntu 10.4 server edition  and I know how to change directories and change permissions.':whistle:'
This is on a virtual server .
               
               

               


                     Modifié par Knight_Shield, 01 mars 2011 - 08:25 .
                     
                  


            

Legacy_HipMaestro

  • Hero Member
  • *****
  • Posts: 2849
  • Karma: +0/-0
Linux boot script question?
« Reply #8 on: March 01, 2011, 08:37:43 pm »


               This may sound trivial, but did you try typing the full path of the module you are trying to open into the command?
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Linux boot script question?
« Reply #9 on: March 02, 2011, 11:57:15 am »


               Linux doesn't use executables.

you start dealing with binaries and other such wondeful stuff.  really you're just attempting to run the nwserver.  For the moment forget file extentions as you know them in a windows world.

so you you want to run nwserver.  You use:
./nwserver

Can you run nwserver without trying to load any module at the moment?
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Linux boot script question?
« Reply #10 on: March 02, 2011, 01:23:32 pm »


               yes this is what I typed exactly

examples

1   ./nwserver

2   ./nwserver -module "module_name"

both bring the   no such file or directory....

??
               
               

               
            

Legacy_Skildron

  • Sr. Member
  • ****
  • Posts: 421
  • Karma: +0/-0
Linux boot script question?
« Reply #11 on: March 02, 2011, 03:32:18 pm »


               Really something like

bash: ./nwserver: No such file or directory
or is it this:

bash: ./nwserver: Permission denied
The difference is, in the first case the file really is not present, in the second case, it is present, but has no executable permissions. If you do a
ls -alF
, what output does ls give you?

Greetings
Skildron
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Linux boot script question?
« Reply #12 on: March 02, 2011, 06:28:54 pm »


               yeah seems odd, sounds like nwserver isn't installed, or it's installed somewhere else other than the directory you are trying to run from.

Skil's instructions including the LS will be important.  Unless there's something drastically top secret, just put the contents of the LS into a quote box.
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Linux boot script question?
« Reply #13 on: March 02, 2011, 09:13:29 pm »


               Ok here is exactly what it does when I ./nwserver


-bash:  ./nwserver: No such file or directory



I did also do the      ls -alF       but the list is long and blows down the whole page.I know there is away to slow it down but I forgot. I did see the nwserver file in green because I set the permissions to 775.
               
               

               
            

Legacy_HipMaestro

  • Hero Member
  • *****
  • Posts: 2849
  • Karma: +0/-0
Linux boot script question?
« Reply #14 on: March 02, 2011, 09:40:58 pm »


               If Linux works like Unix, you can port it into a file using ls -alF > somefilename.  The Linux guys will correct it if it is different in Linux.