Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » ./startup
Forum Rules | Mark all | Recent Posts

./startup
< Newer Topic :: Older Topic > Need some help tweaking it to work

Pages:<< prev 1 next >>
Post is unread #1 Jan 16, 2006, 10:28 am
Go to the top of the page
Go to the bottom of the page

Dralnu

GroupMembers
Posts14
JoinedJan 15, 2006

#! /bin/bash -f

# Set the port number.
set port = 4000
if ( "$1" != "" )
  {
	set port ="$1"
  }

# Change to area directory.
cd ../area

# Set limits.
ulimit -c unlimited
ulimit -s 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 5s

end



Ok. I'm fairly sure for the most part this thing will work, minus this simple error:

./startup: line 54: syntax error: unexpected end of file

That, in other words, means that end isn't a good enough, ahem, end to the file. I tried putting return in (was worht a shot...), and got the same error on the next line. I'm stumped as to what to do. Got Learning the bash shell (O'Reily) sitting on my desk, but it doesn't seem to have anything in there pertaining to ending a shell script, but for the most part I think this works.
I've convered everything over to bash from what I can tell, and it seems like it would work (I've either run the command, or I've found an info page on it), so, yeah. Anyone else who uses the bash shell and would like to use the startup script and can fix this tiny error, hope this helps
       
Post is unread #2 Feb 14, 2006, 11:27 pm
Go to the top of the page
Go to the bottom of the page

Dace K

GroupMembers
Posts5
JoinedFeb 14, 2006

Should work. Sure you have a newline after the end?
       
Pages:<< prev 1 next >>