Re: Telnet times out (fwd)

Thomas Tornblom (Thomas.Tornblom@Nexus.SE)
Wed, 11 Oct 1995 10:17:42 +0100

>
> Once upon a time Mike A Lyons shaped the electrons to say...
> >working.. yet it was still answering the phone. Turned out that it had
> >spontaneously forgotten everything, including it's IP address. Had to
> >rebuild it from scratch. A very.. educational.. experience. :-)
>
> If you have a supported host, use pmreadconf to back it up and next time you
> can just reload the settings in one blow. (Of course, I would hope there
> never *is* a next time.)
>
> -MZ
> --

Below is a little script I made to make sure I have the latest config
handy when and if I have to reload the box:

I run it from cron every night.

Why is it that the portmaster only allows ONE pm* connection at a
time, while it allows three telnets?

It happens now and then that I forget to quit pmconsole and then my
cron jobs that alters a few locations from manual to demand and vice
versa, and this script fails.

Thomas
--------
#!/bin/sh

PATH=$PATH:/opt/pm
CONF=`date +conf.%Y%m%d`
cd /opt/pm/data

if [ $# != "2" ]; then
echo "Usage: pm_dump_conf.sh portmaster password"
exit 1
fi

if pmreadconf $1 $2 $CONF; then # can connect
if [ -f last_conf ]; then
if cmp -s $CONF last_conf; then
rm $CONF # equal, ignore
else
rm last_conf # config updated, save
ln -s $CONF last_conf
fi
else
ln -s $CONF last_conf # first time around
fi
else
rm $CONF # failed read, remove
fi

exit 0