LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 03-15-2003, 02:29 PM   #1
luap
Member
 
Registered: Feb 2003
Location: atlanta ga usa
Distribution: suse 8.2
Posts: 78

Rep: Reputation: 15
cron job?


hello,
once i get my firewall/nat issues resolved, i was thinking
of trying to automate control of my ppp0 nternet connection. currently i start/stop the dsl modem with
short scripts(commands?) anyway, would cron work if i set it up like this:

#turn off modem at 9:15 pm sunday thru thursday, school nights
15 21 * * 0-4 /etc/rc.d/init.d/speedtouch stop
#turn on modem at 9:20 pm sunday thru thursday, i dont go to school
20 21 * * 0-4 /etc/rc.d/init.d/speedtouch start
#turn off modem at 1:30am friday and saturday, let em frag!
30 01 * * 5,6 /etc/rc.d/init.d/speedtouch stop

cron folks, does the syntax look right?(there is a space before the "/etc....")
does 0 = sunday for sure? should i use "sun,mon,tue,wed" instead?
if i run this and it doesnt work,will damage system?
i dont run my machine perpetually- dumb question, will cron jobs
resync to time and run as scheduled?

thanks for any help, tips, comments...
 
Old 03-16-2003, 01:16 AM   #2
ernie
Senior Member
 
Registered: Nov 2001
Location: Toledo, Ohio - USA
Distribution: Mageia 1
Posts: 1,079
Blog Entries: 4

Rep: Reputation: 70
First, I don't know if I would want to start / stop my Internet connection with a cron job, because I may be doing something important, and losing my connection at a scheduled time could cause me to lose my work.

What I do to keep from losing track of time when at my computer is as follows:

I have installed a text to speech software called festival. festival can be downloaded from the University of Edinburgh. The URL is:

http://www.cstr.ed.ac.uk/projects/festival/

You can echo text to festival as:

echo "This is the text string I want to hear" | festival --tts

which pipes the output of the echo command to festival, and the --tts tells festival to treat this input as text-to-speach, and output it to the sound system

I have also created a few scripts which use festival.

One reports the system time each quarter hour using my sound system.

The other is a wrapper for festival so I can create scheduled reminders in cron as:

spkup "Time to get ready for work!"

I set the job to run 30 minutes before I must be at work for 5 consecutive minutes on all 5 days I work. It can be irritating, but I am never late for work.

I also use cron to run fetchmail each quarter hour to retrieve any email. This way, I do not have to run fetchmail as a daemon. I like running services only when I am using them.

If you open a terminal window, and enter:

man 5 cron

You will get the following information with more detail:

The fields in a cron command are as follows:

minute [0-59]<SP>hour [0-23]<SP>day of month [1-31]<SP>month [1-12]{or month name(s)}<SP>day of week [0-7] {0 or 7 = sun, or use names}

Any entry may be a <*> which means first-last

ranges may be used in the form 8-11 which is equal to 8 and 9 and 10 and 11

Lists may be used in the form 1,2,5,9 which is equal to 1 and 2 and 5 and 9

Lists of ranges are permitted as 0-4,8-12 which is equal to 0 and 1 and 2 and 3 and 4 and 8 and 9 and 10 and 11 and 12

ranges may be stepped through as 0-6/2 which is equal to 0 and 2 and 4 and 6

You may step through an entire range with */2 - for example, if you wanted to do something each 2 hours, you can use */2 in the hour field

Hope this helps,
 
Old 03-16-2003, 09:48 AM   #3
luap
Member
 
Registered: Feb 2003
Location: atlanta ga usa
Distribution: suse 8.2
Posts: 78

Original Poster
Rep: Reputation: 15
hello ernie, thanks for the info. the festival software may prove useful, but not for the task i have in mind.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Cron Job petenyce Linux - Newbie 5 10-11-2005 05:03 PM
cron job working2hard Programming 6 07-28-2004 10:12 PM
Cron job rajasekarvr Linux - General 4 05-03-2004 06:35 PM
cron job ? johnyy Linux - Software 3 12-10-2003 07:00 PM
Cron Job imanahmadi Linux - Newbie 1 07-04-2003 12:39 AM


All times are GMT -5. The time now is 09:47 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration