[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Running the server
. . -> [Subject]  No ./startup directory? (nohup error)

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

No ./startup directory? (nohup error)

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2  3  4 

Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Reply #45 on Wed 16 Sep 2009 02:58 PM (UTC)  quote  ]
Message
here's the startup script:

Quote:

#!/bin/sh

####################################################
# Smaug startup script in bash #
# Written by Khtall for Sabrous #
# Functions the same as the normal startup script, #
# but it's written in bash, not csh. #
####################################################

#Name of the shutdown logfile
shutdown='shutdown.txt'

#If a port number was provided ($1 has nonzero length)...
if [ -n "$1" ]
then
#Use the specified value
port="$1"
else
#Otherwise, use the default value
port=4000
fi

#Because Smaug has to be run from the areas folder, move to it
cd "../area"

#If there is a leftover shutdown file from the last time Smaug was run...
if [ -e "$shutdown" ]
then
#...then remove it to avoid confusion.
rm -f "$shutdown"
fi

#Keep restarting Smaug if it dies unless it was deliberately shut down
while (true)
do

#Keep trying logfile numbers until we find one that doesn't exist.
#Start at 1000, for some reason the Smaug coders decided on.
lognumber=1000
logfile=../log/$lognumber.log
while [ -e "$logfile" ]
do
lognumber=`expr $lognumber + 1`
logfile=../log/$lognumber.log
done

#Append the time the MUD started up at to the log and boot files.
date > "$logfile"
date > "../area/boot.txt"

#Check if Smaug is already running by checking if the selected port
#is already bound.
matches=`netstat -an | grep ":$port " | grep -c LISTEN`
if [ "$matches" -ge 1 ]
then
#Smaug is already running, or something else has that port.
echo Port $port is already in use.
echo Make sure that Smaug is not already running.
echo If it is not, make sure nothing else is using port $port.
#We can't do anything, so exit the script
exit 0
fi

#Run Smaug. Use nohup so that it keeps going even after a terminal logout.
nohup ../src/smaug $port >&! $logfile

#If we get here, Smaug has exited. Check if it was shut down, first:
if [ -e "$shutdown" ]
then
#Smaug was shut down and should not be restarted.
#Before we finish, remove the leftover shutdown file.
rm -f $shutdown
#Normal exit
exit 0
fi

#Wait a moment to let old connections die.
sleep 15

done


and the old startup file

Quote:

#!/bin/tcsh

# Set the port number.
set port = 4000
if ( "$1" != "" ) set port="$1"

# Change to area directory.
cd ../area

# Set limits.
nohup
limit stacksize 1024k
limit coredumpsize unlimited
if ( -e shutdown.txt ) rm -f shutdown.txt

while ( 1 )
# If you want to have logs in a different directory,
# change the 'set logfile' line to reflect the directory name.
set index = 1000
while ( 1 )
set logfile = ../log/$index.log
if ( ! -e $logfile ) break
@ index++
end

# Record starting time
date > $logfile
date > ../area/boot.txt

# Run SMAUG.
# Check if already running
set matches = `netstat -an | grep ":$port " | grep -c LISTEN`
if ( $matches >= 1 ) then
# Already running
echo Port $port is already in use.
exit 0
endif
../src/smaug $port >&! $logfile

# Restart, giving old connections a chance to die.
if ( -e shutdown.txt ) then
rm -f shutdown.txt
exit 0
endif
sleep 15
end



i deleted the extra space, trying to run startup now...

nope, same deal.


sabrous@ps14248:~/src$ chmod u+x startup
sabrous@ps14248:~/src$ ./startup
: No such file or directory.
sabrous@ps14248:~/src$ dos2unix startup
sabrous@ps14248:~/src$ ./startup
/proc/net/tcp: Permission denied

same with sabstartup:

sabrous@ps14248:~/src$ chmod u+x sabstartup
sabrous@ps14248:~/src$ ./sabstartup
-bash: ./sabstartup: /bin/sh^M: bad interpreter: No such file or directory
sabrous@ps14248:~/src$ dos2unix sabstartup
sabrous@ps14248:~/src$ ./sabstartup
/proc/net/tcp: Permission denied


Star wars 'is a good movie.'
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #46 on Wed 16 Sep 2009 03:01 PM (UTC)  quote  ]
Message
Which startup file is which?

Try deleting this section, it's probably the one checking /proc/net/tcp:

#Check if Smaug is already running by checking if the selected port
#is already bound.
matches=`netstat -an | grep ":$port " | grep -c LISTEN`
if [ "$matches" -ge 1 ]
then
#Smaug is already running, or something else has that port.
echo Port $port is already in use.
echo Make sure that Smaug is not already running.
echo If it is not, make sure nothing else is using port $port.
#We can't do anything, so exit the script
exit 0
fi


(Also, the code tags are easier to read for that sort of thing than the quote tags.)
(EDIT: Among other things, the code tags let you preserve indentation of files; when I copy/pasted, I was left with the above without spaces.)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Reply #47 on Wed 16 Sep 2009 03:09 PM (UTC)  quote  ]

Amended on Wed 16 Sep 2009 03:12 PM (UTC) by Gogoicarus

Message
woops. my bad.

the first script is the one my coder wrote, which i'd prefer to use.

i think we're on to something! my command prompt appears hung, but the MUD itself booted up and people can connect.

the problem now is that when i hit ctrl+c to bring back my prompt or close putty, it goes down again. i tried a nohup, but no dice.

but at least the startup script is running...so some headway is being made.

here's the edited script, in a code tag.


#!/bin/sh

####################################################
# Smaug startup script in bash                     #
# Written by Khtall for Sabrous                    #
# Functions the same as the normal startup script, #
# but it's written in bash, not csh.               #
####################################################

#Name of the shutdown logfile
shutdown='shutdown.txt'

#If a port number was provided ($1 has nonzero length)...
if [ -n "$1" ] 
then
  #Use the specified value
  port="$1"
else
  #Otherwise, use the default value
  port=4000
fi

#Because Smaug has to be run from the areas folder, move to it
cd "../area"

#If there is a leftover shutdown file from the last time Smaug was run...
if [ -e "$shutdown" ]
then
  #...then remove it to avoid confusion.
  rm -f "$shutdown"
fi

#Keep restarting Smaug if it dies unless it was deliberately shut down
while (true)
do
  
  #Keep trying logfile numbers until we find one that doesn't exist.
  #Start at 1000, for some reason the Smaug coders decided on.
  lognumber=1000
  logfile=../log/$lognumber.log
  while [ -e "$logfile" ]
  do
    lognumber=`expr $lognumber + 1`
    logfile=../log/$lognumber.log
  done
  
  #Append the time the MUD started up at to the log and boot files.
  date > "$logfile"
  date > "../area/boot.txt"
  
  #Check if Smaug is already running by checking if the selected port
  #is already bound.
  #matches=`netstat -an | grep ":$port " | grep -c LISTEN`
  #if [ "$matches" -ge 1 ]
  #then
    #Smaug is already running, or something else has that port.
    #echo Port $port is already in use.
    #echo Make sure that Smaug is not already running.
    #echo If it is not, make sure nothing else is using port $port.
    #We can't do anything, so exit the script
    #exit 0
  #fi
  
  #Run Smaug. Use nohup so that it keeps going even after a terminal logout.
  nohup ../src/smaug $port >&! $logfile
  
  #If we get here, Smaug has exited. Check if it was shut down, first:
  if [ -e "$shutdown" ]
  then
    #Smaug was shut down and should not be restarted.
    #Before we finish, remove the leftover shutdown file.
    rm -f $shutdown
    #Normal exit
    exit 0
  fi
  
  #Wait a moment to let old connections die.
  sleep 15
  
done

Star wars 'is a good movie.'
[Go to top] top

Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Reply #48 on Wed 16 Sep 2009 03:19 PM (UTC)  quote  ]
Message
o...kay...now the original script works just fine.

i deleted that troublesome space, converted it to unix, chmod'd it appropriately and now, for mysterious reasons unknown to me, it is suddenly working.

literally no changes have been made to it from the last time i reported on it not running.

could it be that startup was somehow conflicting with the non-running sabstartup? because editing sabstartup made the original startup work fine.

i am so utterly baffled.

Star wars 'is a good movie.'
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #49 on Wed 16 Sep 2009 03:28 PM (UTC)  quote  ]
Message
Chances are that you changed something, and then thought you changed it back or something, but didn't. It's easy to make mistakes like that when changing lots of things in lots of places over a very short period of time, when trying to get something to work.

Anyhow, you need to run your script in the background:

nohup ./startup &

the nohup says to not die when the terminal "hups" (hangs up) and the & at the end says to run in the background.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Reply #50 on Wed 16 Sep 2009 03:31 PM (UTC)  quote  ]
Message
yeah, i did my old default typing of nohup ./startup 4000 & almost on autopilot in the faint hope of it working. and it did. how puzzling.

now i'm getting some i3 errors from players logging in

Comm: Loading player data for: Nelren (10K)
Log: [*****] FILE: ../player/n/Nelren LINE: 155
Log: [*****] BUG: Fread_char: no match: i3perm
Log: [*****] FILE: ../player/n/Nelren LINE: 155
Log: [*****] BUG: Fread_char: no match: 1
Log: [*****] FILE: ../player/n/Nelren LINE: 156
Log: [*****] BUG: Fread_char: no match: i3flags
Log: [*****] FILE: ../player/n/Nelren LINE: 156
Log: [*****] BUG: Fread_char: no match: 256

but i know the reason for this: we removed i3 early on when moving to the new server, because we thought we didn't use it. i think it might have been causing some errors, too.

i don't recall ever editing i3, though...i'll tackle this more after i actually get some breakfast and do some real-life stuff.


Star wars 'is a good movie.'
[Go to top] top

Posted by Zeno   USA  (2,868 posts)  [Biography] bio   Moderator
Date Reply #51 on Wed 16 Sep 2009 06:44 PM (UTC)  quote  ]
Message
Those are just warnings. It shouldn't cause any issues.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,043 views.

This is page 4, subject is 4 pages long:  [Previous page]  1  2  3  4 

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]