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
|