LinuxQuestions.org
Review your favorite Linux distribution.
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-04-2004, 11:09 AM   #1
sdebiasio
LQ Newbie
 
Registered: Jul 2004
Posts: 22

Rep: Reputation: 15
Cron job failed - what am I missing?


Hi -

I am trying to set up a "test" cron job which will simply email me at a scheduled time. Here are the steps that I followed:

1) created a cron job using crontab -e and included the following command:

00,10,20 9-15 * * * echo "testing" /usr/sbin/sendmail myemail@mydomain.com

2) I saved this file and named it "testy"

3) I exited out of my editor and typed "crontab testy" at the command line

4) I checked, using crontab -l, to make sure the job was listed, and it was

However I never got the email at the scheduled time. Any ideas on what I'm doing wrong?

Thanks!
 
Old 08-04-2004, 11:45 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Does that command work if you type it in manually?

I would figure you wanted something like this:
echo "testing" | /usr/sbin/sendmail myemail@mydomain.com

I don't use sendmail, so I'm not positive about that...

Also, does the user running the cron job have permission to execute sendmail?
 
Old 08-04-2004, 11:50 AM   #3
sdebiasio
LQ Newbie
 
Registered: Jul 2004
Posts: 22

Original Poster
Rep: Reputation: 15
I am doing it as 'root', so the permission shouldn't be an issue.

Here's my next question looking at your thread - I think you might be right, but which keyboard key should I be using for that vertical line "l" in the command?

It sounds like a silly question but I couldn't figure out which key translated into that character in the syntax! I don't think it's a "1" or an "l".

Sorry for the dumb question - this is still brand-new to me!
 
Old 08-04-2004, 11:54 AM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Actually, it's a separate key (not a 1 or a lowercase L). Most refer to it as "the pipe", and on my keyboard, it's located on the same key the backslash is ( \ ); you just have to hold shift to get it.

And just to be thorough, the pipe tells the system to take the output of the command on the left, and feed it as input to the command on the right.
 
Old 08-04-2004, 12:14 PM   #5
sdebiasio
LQ Newbie
 
Registered: Jul 2004
Posts: 22

Original Poster
Rep: Reputation: 15
Thank you! I never would have figured that out; the character above my backspace key looks like two short stacked vertical lines. I am going to try this again with the 'pipe' added.
 
Old 08-04-2004, 12:23 PM   #6
sdebiasio
LQ Newbie
 
Registered: Jul 2004
Posts: 22

Original Poster
Rep: Reputation: 15
That did the trick! There's my smile for the day . Thank you for your help.
 
Old 08-04-2004, 12:35 PM   #7
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
You're quite welcome

Glad I could help.
 
Old 08-04-2004, 12:53 PM   #8
jdruin
Member
 
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Rep: Reputation: 30
To expand on Dark_Helmets excellent response, I read recently that current versions of the Linux shell perform the "piping" operation by having the first or lefthand program write its output to a file and then having the second process reciveve the contents of that file. Apparently the OS can feed the second program variable amounts of the file until the file os exhasuted in case the second program cannot process the entire "pipe" file all at once. Just FYI. The book is Linux Programming By Example just to be fair to the author I got the info from.
 
  


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
Cron Job petenyce Linux - Newbie 5 10-11-2005 04:03 PM
cron job wbatzle Linux - Newbie 2 07-12-2005 04:19 PM
cron job the_rhino Linux - Newbie 10 10-02-2004 03:34 PM
cron job ? johnyy Linux - Software 3 12-10-2003 06:00 PM
cron job thesnaggle Linux - Newbie 1 09-19-2003 10:47 AM

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

All times are GMT -5. The time now is 11:40 PM.

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