LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cron job failed - what am I missing? (https://www.linuxquestions.org/questions/linux-newbie-8/cron-job-failed-what-am-i-missing-213333/)

sdebiasio 08-04-2004 11:09 AM

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!

Dark_Helmet 08-04-2004 11:45 AM

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?

sdebiasio 08-04-2004 11:50 AM

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! :rolleyes:

Dark_Helmet 08-04-2004 11:54 AM

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.

sdebiasio 08-04-2004 12:14 PM

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.

sdebiasio 08-04-2004 12:23 PM

That did the trick! There's my smile for the day :) . Thank you for your help.

Dark_Helmet 08-04-2004 12:35 PM

You're quite welcome :)

Glad I could help.

jdruin 08-04-2004 12:53 PM

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.


All times are GMT -5. The time now is 12:14 PM.