UNIXPC communication questions
William H. Huggins
eed_wwhh at jhunix.HCF.JHU.EDU
Wed Apr 26 01:57:11 AEST 1989
In article <678 at icus.islp.ny.us> lenny at icus.islp.ny.us (Lenny Tropiano) writes:
>In article <23118 at shemp.CS.UCLA.EDU> kirkaas at cs.ucla.edu (paul kirkaas) writes:
>|>switch to data or voice? I mean, I want to write a script that is scheduled
>|>by cron to make sure that the pc is is in a given mode at a given time. I
>|>don't want to automatically toggle if it is already in the right mode.
>|>
>Yes, I did exactly that with a little utility. Since it's small I'm reposting
>it again. Basically it is invoked like:
>
>$ phset DATA -or- phset VOICE
> -Lenny
A littler shell program phnset (when linked to the names
ph0set and ph1set) which controls both ph0 and ph1,
and provides for restoring state to previous value:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# phnset -- writes prior state (D or V) on stdout and then
# sets ph[01] to DATA (D) or VOICE (V) Rel 3.51
case $0 in
*ph0set) PHN=ph0 ;;
*ph1set) PHN=ph1 ;;
*phnset) echo "Invoke as ph0set or ph1set."
exit ;;
esac
case $# in
0) cat <<-EOF
Usage: ${PHN}set [ D | V ]
sets $PHN to DATA or VOICE.
EOF
exit ;;
esac
if [ -f /usr/spool/uucp/LCK..$PHN ] # is VOICE
then echo V
case $1 in
d|D) /usr/bin/phtoggle ;;
v|V) ;;
esac
else echo D
case $1 in # is DATA
d|D) ;;
v|V) /usr/bin/phtoggle ;;
esac
fi
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
An example of use:
# USNOset -- reset clock from USNavalObservatory
OM=`/usr/lib/uucp/ph0set D` # save prior ph0 mode
sleep 55 # to prevent retriggering
echo "On \c"; date # time stamp
/etc/usnotime 2>&1 # set clocks stdout
sleep 5 # pause
OM=`/usr/lib/uucp/ph0set $OM` # restore prior ph0 mode.
W.H. Huggins.
--
W.H. Huggins ECE Dept.
Home: 8894780 (voice), 8895433 (data))
More information about the Comp.sys.att
mailing list