LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-08-2009, 06:02 AM   #1
scott_audio
Member
 
Registered: Jul 2009
Location: USA
Distribution: openSUSE 11.1, Kubuntu 9.04
Posts: 35

Rep: Reputation: 16
case - exec commands based on time range


I use speech for a lot of notifications, email, time every 30 minutes, system alerts, etc... but there are times when I do not want the speech, because I am on a conference call or have an open mic.

Can you guide me toward the right documentation to read to accomplish this, please?

basically,

if time is NOT between (list of times here) do command is what I need

Thanks,
Scott

Last edited by scott_audio; 08-08-2009 at 10:41 AM. Reason: title change for better searching
 
Old 08-08-2009, 07:36 AM   #2
scott_audio
Member
 
Registered: Jul 2009
Location: USA
Distribution: openSUSE 11.1, Kubuntu 9.04
Posts: 35

Original Poster
Rep: Reputation: 16
hmm, it just occurred to me that i could have a variable that =on or =off, duh, and check that for my speech actions. It would still be interesting to see what it would look like though, in a script, to execute a command unless it is between a time range, just for the sake of learning something.
 
Old 08-08-2009, 09:31 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
What's wrong with turning down the volume by buttons on a multimedia keyboard (if you have one) or by physical volume control on the speakers?

If you want a software solution, your question is not answerable without information about which software you are using to produce the sound.
 
Old 08-08-2009, 10:04 AM   #4
scott_audio
Member
 
Registered: Jul 2009
Location: USA
Distribution: openSUSE 11.1, Kubuntu 9.04
Posts: 35

Original Poster
Rep: Reputation: 16
I need other sounds, just not the speech synthesis. For example, when on a conference call, I often 'broadcast' portions of pre-recorded conversations, but I would not want 600-1000 people to hear my incoming email notifications or my quarterly time announcements.

I have figured out how to disable the speech - I created aliases that either creates an empty file 'speech' or deletes the same file, then in my email filters, time script, etc. I just added a 'if [ -e ~/speech ] then dothis else exit'.

Now I'm just curious how to, if I ever need to, script conditional processing based on time - if it is between 8 PM and 10 PM, for example, then it's ok to process, or how to execute commands only if the time is outside those ranges.

If you're just curious, I use festival with better voices, and I use Cepstral's Swift (cepstral.com) as well, but that's not really needed for the question to be answered.

hope you have a good day,
Scott
 
Old 08-08-2009, 10:27 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Code:
hour="$(date '+%H')" 
case "$hour"
	20 | 21 )
		<commands>
		;;
esac
It could be done with an "if" of course but the case allows you to add further, er, cases when you need
 
Old 08-08-2009, 10:33 AM   #6
scott_audio
Member
 
Registered: Jul 2009
Location: USA
Distribution: openSUSE 11.1, Kubuntu 9.04
Posts: 35

Original Poster
Rep: Reputation: 16
ahh ok, I see now, as usual, I make things more difficult than they need to be. It will be fun to put it to use now. Thanks

Scott
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux machine gets stuck after 8 hours or 12 hours fahadaziz Linux - Newbie 4 03-28-2010 04:19 PM
Server aburptly stops running High CPU usage PERL script after about 5 hours bpmee Linux - Server 3 05-18-2007 11:24 AM
Sheduling a .sh to run every 4 hours rainwoman Linux - Newbie 2 09-28-2005 12:48 PM
Schedule a script every three hours dkochan Linux - General 1 03-07-2004 10:18 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration