![]() |
#1 |
New Member
|
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 |
![]() |
![]() |
![]() |
#2 |
Senior Member
|
![]() 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 =). |
![]() |
![]() |
![]() |
#3 |
New Member
|
|
![]() |
![]() |
![]() |
#4 |
Member
Join Date: May 2002
Location: Linköping, Sweden
Posts: 31
![]() |
![]() Argh, a shell-script in csh!
|
![]() |
![]() |
![]() |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shell Accounts | fatemud | MUD Coding | 0 | 09-19-2006 06:40 PM |
Unzipping a MUD into the shell | NotL337 | MUD Coding | 4 | 04-12-2006 12:12 AM |
Shell for use | Terron | Advertising for Staff | 0 | 07-26-2004 12:17 AM |
Which scripting language? | Gakusei | MUD Coding | 9 | 03-14-2004 08:39 AM |
Scripting | gutterzombie | MUD Builders and Areas | 6 | 01-28-2004 01:30 PM |
|
|