Thread: shell scripting
View Single Post
Old 05-22-2002, 10:54 PM   #1
Emit
New Member
 
Join Date: May 2002
Location: Kentucky
Posts: 14
Emit is on a distinguished road
Send a message via AIM to Emit
The shell script i'm using to startup the mud i work for was written for someone else, a friend of the mud's owner. I know a little unix only so i thought i would ask for some advice with this, if you guys don't mind. Here's what the script looks like now.

[code]
#!/bin/csh
limit core unlimited
set port = 4000
if ( "$1" != "" ) set port="$1"
cd area
if ( -e ../data/shutdown.txt ) rm -f ../data/shutdown.txt
while ( 1 )
set index = 1000
while ( 1 )
set logfile = ../log/$index.log
# if ( -e $logfile ) gzip -9 $logfile
#
if ( ! -e $logfile.gz ) break
@ index++
end
if ( -e core ) then
mv core ../coredumps/`date +%m-%d-%y.core`
endif
# rm ../data/ips.txt
../src/MiddleEarth $port >&! $logfile
if ( -e ../data/shutdown.txt ) then
rm -f ../data/shutdown.txt
exit 0
endif
sleep 8
end
[/quote]

so, i understand most everything it does, and just have a few questions. i assume ( -e blah.txt) evaluates to true if a file is present? the problem we're having is that we never get the log file in gzip form if an old one is present, it just keeps getting overwritten. ideally we would have logs named "1000.log" up to "1010.log" or higher, depending on how many times the mud restarts. also, what exactly would the ">&!" do? i know ">" will put the output in the file, and "&" will run it in the background(maybe yes?) but "!" i have no clue on.
Thanks,
-Emit
Emit is offline   Reply With Quote