Website build script

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Website build script
Date: 2003-03-11 20:35:29
Message-ID: 03AF4E498C591348A42FC93DEA9661B8259D7E@mail.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

The following script is currently used to build our main website. Static
HTML versions of each of the pages are generated from php scripts on an
hourly basis by this script, but the other day for some reason it
generated an empty index page, but gave no errors that we have been able
to find.

We've more or less resigned ourselves to this being a glitch, but
figured it wouldn't hurt to get a few extra sets of eyes over the script
anyway. Any comments or suggestions for improvements would be
appreciated.

Regards, Dave.

#! /bin/sh

########################################################################
#######
# chksvr - Check the status of the specified server
#
# $1 = Server
# $2 = Port
# $3 = Database
# $4 = User Name
########################################################################
#######
chksvr()
{
# Dummy query to check the server status
status=`/usr/local/bin/psql -h $1 -p $2 -U $4 -d $3 -A -t -F '' -c
"SELECT 'SERVER_UP'"`

if [ "$status" != "SERVER_UP" ]; then
mail -s "WARNING: Server $1:$2 is down!!" webmaster(at)postgresql(dot)org <
/tmp/svr-status
rm /tmp/svr-status
exit 1
fi
}

########################################################################
#######
# buildpage - build an HTML page from a PHP page
#
# $1 = page name with path, but no extension
########################################################################
#######
buildpage()
{
/usr/local/bin/lynx -source http://www.postgresql.com$1.php \
| /usr/bin/perl -pe '$_ = " $_ "; tr/ \t/ /s; $_ = substr($_,1,-1)'
\
> /usr/local/www/www.postgresql.org$1.html
}

########################################################################
#######
# Check the database servers
########################################################################
#######
echo Checking databases...

chksvr dbsvr1.postgresql.org 5432 186_portal portal > /tmp/svr-status
2>&1
chksvr dbsvr2.postgresql.org 5432 gborg www > /tmp/svr-status 2>&1
chksvr dbsvr3.postgresql.org 5432 mirrors vev > /tmp/svr-status 2>&1

########################################################################
#######
# Build the site
########################################################################
#######

echo Building site...

# The main portal
buildpage /index
buildpage /licence
buildpage /lists
buildpage /unavailable

# News/Events
buildpage /eventform
buildpage /newsform
buildpage /event-archive
buildpage /news-archive

# The Mirrors
buildpage /mirrors-ftp

# Docs
buildpage /docs/index
buildpage /docs/awbook
buildpage /docs/bookoneyearon
buildpage /docs/booktips

# User's Lounge
buildpage /users-lounge/index
buildpage /users-lounge/books
buildpage /users-lounge/features
buildpage /users-lounge/interfaces
buildpage /users-lounge/limitations
buildpage /users-lounge/related

# Cleanup
rm /tmp/svr-status

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2003-03-11 20:38:27 Re: Roadmap for FE/BE protocol redesign
Previous Message Christopher Browne 2003-03-11 20:01:44 Re: Largest filesize under Linux