I've written two small utilities that make checking for new patches
on the ftp.service.digital.com patch server and new DSNlink articles easy.
They may be run from cron and mail their output.
If you don't have dsnlink, the first one will use ftp to get the patch
directory listing. For this to work, you must have a $HOME/.netrc file.
Here's an example, see the ftp and netrc man pages for more info.
# ls .netrc
-rw------- 1 camel users 115 Apr 22 18:05 .netrc
# more .netrc
machine ftp.service.digital.com login anonymous password
camel_at_bigbusiness.com
Alan Davis
Tru64 Unix Consultant
----- cut here
#!/bin/ksh
# run from cron
# 10 5 1 * * /usr/users/me/bin/getnewpatch
MAILTO=sysadmin
PATCHDIR=public/dunix/v4.0e
# if dsn is available, use it
[ -x /usr/ucb/dsnlynx ] && {
/usr/ucb/dsnlynx -dump
ftp://ftp.service.digital.com/$PATCHDIR | \
/usr/bin/mailx -s "Patches for v4.0e" $MAILTO
exit
}
# otherwise, use ftp
[ -r $HOME/.netrc ] && {
/usr/bin/grep -iqs "ftp.service.digital.com" $HOME/.netrc
[ $? ] && {
/usr/bin/ftp ftp.service.digital.com >/dev/null <<EOF
pipe
cd $PATCHDIR
ls -l |"cat > /tmp/getnewpatch.$$"
bye
EOF
/usr/bin/mailx -s 'Patches for v4.0e' $MAILTO < /tmp/getnewpatch.$$
/usr/bin/rm -f /tmp/getnewpatch.$$
}
}
------ cut here
#!/bin/ksh
# run from cron
# 0 5 1 * * /usr/users/me/bin/getnewdsn
MAILTO=sysadmin
DSNDIR=/usr/users/admin/dsn # put the date of last run in file
here
DSNDB=osf # which dsn database to use
LAST=`cat ${DSNDIR}/lastgetnew.dat`
DATE=`/usr/bin/date "+%m/%d/%Y"`
D=`/usr/bin/date "+%m.%d.%Y"`
cd $DSNDIR
/usr/bin/cat /dev/null > /tmp/dsn_new.$$
/usr/ucb/dsnits >/dev/null 2>&1 <<EOF
open $DSNDB
ls -all -beginning $LAST
cat /tmp/dsn_new.$$ -ls
exit
EOF
[ -s /tmp/dsn_new.$$ ] && {
/usr/bin/mailx -s "New DSN articles $D" $MAILTO < /tmp/dsn_new.$$
}
/usr/bin/rm -f /tmp/dsn_new.$$
echo $DATE > $DSNDIR/lastgetnew.dat
exit
-------- cut here
-----
Alan C. Davis Employed by, but not
Technology Services speaking for:
davis_at_tessco.com Tessco, Inc.
http://www.tessco.com
Received on Thu Apr 22 1999 - 23:19:15 NZST