pjs/webtools/newsbot/newsbot.sh

45 строки
1.5 KiB
Bash
Исходник Обычный вид История

1999-03-20 11:19:28 +03:00
#!/bin/ksh
# Run this from cron to re-create newsbot.html if new messages
# have been sent to newsbot.
# Created 16 Mar 1999 by endico@mozilla.org
#
1999-03-22 04:40:22 +03:00
# i had to use ksh because sh doesn't recognize -nt
# find a more portable way to do this that doesn't suck as badly as using find
2000-03-04 02:52:48 +03:00
PATH=/opt/gnu/bin:/opt/tools/bin:/usr/ucb:$PATH
1999-03-20 11:19:28 +03:00
export PATH
1999-03-22 04:40:22 +03:00
CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
export CVSROOT
# update the newsbot sources
1999-03-22 05:13:32 +03:00
cvs -q -d $CVSROOT update -dP
1999-03-22 04:40:22 +03:00
1999-03-22 03:55:53 +03:00
# Run newsbot if new mail has arrived or the code has been updated.
1999-03-20 11:19:28 +03:00
if [ \( /var/mail/newsbot -nt /opt/newsbot/newsbot.html \) -o \
\( /opt/newsbot/newsbot.pl -nt /opt/newsbot/newsbot.html \) ]
then
echo "rebuilding newsbot file"
/opt/newsbot/newsbot.pl /var/mail/newsbot /opt/newsbot/newsbot.rdf.tmp > /opt/newsbot/newsbot.html
1999-03-20 11:19:28 +03:00
# copy the rdf file into file used by web site
cp /opt/newsbot/newsbot.rdf.tmp /opt/newsbot/newsbot.rdf
fi
# Do this separately in case wrapnews failed the last time this script ran.
# Sometimes it fails because this script runs at the same time the staging
# area is being rebuilt and the wrapper scripts are missing.
if [ \( /opt/newsbot/newsbot.html -nt /opt/newsbot/index.html \) -a \
\( -e "/e/stage-docs/mozilla-org/tools/wrap.pl" \) -a \
\( -e "/e/stage-docs/mozilla-org/html/template.html" \) ]
then
echo "wrapping newsbot file"
# wrap file and place in newsbot directory
1999-03-20 11:19:28 +03:00
/opt/newsbot/wrapnews.pl
# copy the wrappped file into file used by web site.
cp /opt/newsbot/wrapped.html /opt/newsbot/index.html
1999-03-20 11:19:28 +03:00
fi