Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!dogie.macc.wisc.edu!indri!aplcen!jhunix!eed_wwhh From: eed_wwhh@jhunix.HCF.JHU.EDU (William H. Huggins) Newsgroups: comp.sys.att Subject: Re: UNIXPC communication questions Summary: Small is Beautiful! Keywords: phtoggle, usnotime Message-ID: <1581@jhunix.HCF.JHU.EDU> Date: 25 Apr 89 15:57:11 GMT References: <23118@shemp.CS.UCLA.EDU> <678@icus.islp.ny.us> Reply-To: eed_wwhh@jhunix.UUCP (William H. Huggins) Distribution: usa Organization: The Johns Hopkins University - HCF Lines: 63 In article <678@icus.islp.ny.us> lenny@icus.islp.ny.us (Lenny Tropiano) writes: >In article <23118@shemp.CS.UCLA.EDU> kirkaas@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))