![]() |
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 |
That's right. -e tests for existance.
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.[/quote] That's because the code that gzips the file is commented out! Immediately afterwards, it checks if the gzipped file exists, and if it doesn't, it stops before it increments the index count -- that's why it overwrites the file afterwards. Simply remove the two "#" comments at the front of the line, and you should be fine =). |
|
Argh, a shell-script in csh!
|
All times are GMT -4. The time now is 09:06 PM. |
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022