Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
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
Old 05-23-2002, 06:51 AM   #2
Yui Unifex
Senior Member
 
Join Date: Apr 2002
Location: Florida
Posts: 323
Yui Unifex is on a distinguished road
Send a message via ICQ to Yui Unifex Send a message via AIM to Yui Unifex
Question

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 =).
Yui Unifex is offline   Reply With Quote
Old 05-26-2002, 11:07 AM   #3
Emit
New Member
 
Join Date: May 2002
Location: Kentucky
Posts: 14
Emit is on a distinguished road
Send a message via AIM to Emit
Emit is offline   Reply With Quote
Old 05-26-2002, 02:48 PM   #4
mhc
Member
 
Join Date: May 2002
Location: Linköping, Sweden
Posts: 31
mhc is on a distinguished road
Smile

Argh, a shell-script in csh!
mhc is offline   Reply With Quote
Reply


Thread Tools


shell scripting - Similar Threads
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 06:05 PM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2022