[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] [RAQ3i] Determining site number for domain
- Subject: Re: [cobalt-users] [RAQ3i] Determining site number for domain
- From: "Brad Rathbun" <brad@xxxxxxxxxxxxxxx>
- Date: Mon Jul 10 11:12:12 2000
- Organization: CyberHighway of Northern Nevada
> > I'm trying to automate a script I use regularly. Is there an easy way to
> > turn a FQDN into a site number from a bash script? Or maybe a file I
could
> > easily grep for it? So far, the best I've come up with is to do 'ls -l
> > www.domain.com' and then do a find. Works, but seems a bit convoluted.
> > Anyone have a better way to do this? A search of the 800+ articles in
the
> > archives that I went through yielded nothing useful. 8^(
And to answer my own question, here's what I came up with:
# Get site number from FQDN
SITENUMBER=`ls -alF /home/sites/$SITENAME`
SITENUMBER=${SITENUMBER#*/home/sites/site}
SITENUMBER=${SITENUMBER%%/}
It works exactly as I wanted it, returning a site number when given a
sitename (eg, it turns www.domain.com into 22 which I then prepend with the
word 'site' to come up with site22). Anyone who can improve on it, please
let me know, I am new to programming the shell and this is probably the hard
way to do it.
Now, I'm looking for a way to turn the site number into the login of the
site admin. So far, the only thing I've come up with is to grep the
/etc/passwd file for the site number. This sort of works, but produces a
list of every user associated with that site instead of just the site admin.
Suggestions as to where I should look for this info would be greatly
appreciated and any code resulting from the info will be posted to the list
for others to use.
TIA,
-----------------------------------------------
Brad Rathbun
Follow the Leader! CompuTech Internet Services