@lay:Listing 6 <\#150><\#150> 2095l6

@cx:#!/bin/sh<\n>
<\n>
#<\n>
# this script causes the ghosting server<\n>
# to drift on and off the internet<\n>
#<\n>
<\n>
#<\n>
# see if we may need to restart diald<\n>
#<\n>
if ! `ps <\#150>ax | grep diald >>/dev/null` ; then<\n>
<\n>
 # if so bring it up<\n>
 /etc/ppp/diald<\#150>up<\n>
<\n>
# wait for diald to come up<\n>
 sleep 5<\n>
<\n>
fi<\n>
<\n>
#<\n>
# see if we are already connected to the net<\n>
#<\n>
<\n>
if ! `ifconfig | grep <\#34>^ppp<\#34> >/dev/null` ; then<\n>
<\n>
 # if not, bring link up<\n>
 ping <\#150>c 1 myisp.net >/dev/null<\n>
<\n>
 # wait for link to come up<\n>
 sleep 60<\n>
<\n>
fi<\n>
<\n>
#<\n>
# see if we want to come back up<\n>
#<\n>
# normally I only want to be ghosting Monday<\n>
# through Friday from 7a to 6p<\n>
#<\n>
<\n>
day=`date +%w`<\n>
hour=`date +%H`<\n>
if `expr match $day <\#34>[123456]<\#34> <\#34>&<\#34> $hour <\#34>><\#34> 6 <\#34>&<\#34><\\><\n>
	$hour <\#34><\<><\#34> 18 >/dev/null` ;<\n>
then<\n>
<\n>
 # calculate delay for next up time between 15 and<\n>
 # 60 minutes<\n>
 nxt=`expr $$ % 45 + 15`<\n>
<\n>
 # append info to file<\n>
 echo `date` <\#34>Back: $nxt<\#34> >> /var/run/ppp.info<\n>
<\n>
 # send info to desired destination<\n>
 mail <\#150>S ghostship me<\@>myisp me<\@>work<\\><\n>
	<\<> /var/run/ppp.info<\n>
<\n>
 # create an at job to force return<\n>
 at now + $nxt minutes <\<>EOF >/dev/null 2>&1<\n>
 /etc/ppp/appear<\n>
EOF<\n>
<\n>
fi<\n>
