Mailinglist Archive: opensuse (1983 mails)

< Previous Next >
Re: [SuSE Linux] Clock question
  • From: leonmcclatchey@xxxxxxxxxxxx (Leon McClatchey)
  • Date: Wed, 09 Dec 1998 22:20:08 -0600
  • Message-id: <366F4BF5.D2EEE447@xxxxxxxxxxxx>



Hello:-)

Kieran Sullivan wrote:

> Try the date command. It will tell you the hour...
>

yeppers, and it works really great in a script too:-) My better half
wanted the modem to be noisy during certain hours and quiet other hours.
So after much testing to get the hang of the bash syntaks and things, I got
one that worked and incorporated into my diald connect script. So now
between 9am and 9pm we've got a noisy modem otherwise the modem just
quietly goes about its business:-)

To make this work, I expanded the original connect script that was
distributed with diald so I could use a total of 5 initiation strings (I
just like to make sure the modem is setup the way it should be (must be all
that past sysop experience:-) BTW, the fifth initiation string just sets
the registers, the time test is done on the 4th initiation string:-)

As far as all the variables that can be used to format the response of
"date" try man date:-)

But for my purposes.....

CTIME=`date +%H%M`
STIME=900
ETIME=2100

if [ $CTIME -ge $STIME -a $CTIME -le $ETIME ] ; then
USE = $INIT_4
else
USE = $INIT_4'M0'
fi

Then the chat stuff for initializing the modem, with the usual ABORT,
though I did add REPORT ERROR in the initiation sequence. As far as the
actual dialout sequence, I added REPORT CONNECT. Then whenever I call
chat, use -f /var/log/chat and it reports connect rate and what errors
occurred (if any:-).

> > Ok ok, isn't it possible to know which hour it is unless i'm root ?
> > That's funny, but all users would like to be able to read it !

Try making a script
#!/bin/sh
#
# tod - Reports the time of day
#
echo `date +%H:%M
#
# The above reports the time in military format, check "man date" to get
the
# full formatting capabilities:-)
#


--
cya l8r
Leon McClatchey
leonmcclatchey@xxxxxxxxxxxx
Linux User 78912 (Win95 Box)

-
To get out of this list, please send email to majordomo@xxxxxxxx with
this text in its body: unsubscribe suse-linux-e
Check out the SuSE-FAQ at <A HREF="http://www.suse.com/Support/Doku/FAQ/";><A HREF="http://www.suse.com/Support/Doku/FAQ/</A">http://www.suse.com/Support/Doku/FAQ/</A</A>> and the
archiv at <A HREF="http://www.suse.com/Mailinglists/suse-linux-e/index.html";><A HREF="http://www.suse.com/Mailinglists/suse-linux-e/index.html</A">http://www.suse.com/Mailinglists/suse-linux-e/index.html</A</A>>


< Previous Next >
References