Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-20-2007, 06:53 AM   #1
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Rep: Reputation: 15
Script run by crontab won't send email


What I want to do is to run a script every 5 min. let's say. What the script actually does is to ping some hosts and if the host does not reply send an email to me.

If i just run the script "/usr/bin/script" it works perfectly. The script is 777 chmod-ed.

I've added in crontab something like:

*/5 * * * * /usr/bin/netpoint_mon
also I've tried:

*/5 * * * * /usr/bin/netpoint_mon 2>&1
But it doesn't send any mail like this.
Also I've tried (with no result):

* * * * * /usr/bin/netpoint_mon
* * * * * /usr/bin/netpoint_mon 2>&1
Also the scripts generates some logs. With the line:
*/5 * * * * /usr/bin/netpoint_mon
new entries are added to the log files but no mail is sent. In addition to that if I do a "sendmail -bp" i get "-- 3696 Kbytes in 588 Requests."

All of the requests look something like this:

87ED07A489D     6952 Wed Dec 19 20:40:11
(delivery temporarily suspended: connect to[](This is my smtp): Connection timed out)
it says "Connection timed out" but if i run the script manually it sends all the emails as expected.

What am I doing wrong ? Thanks.
Old 12-21-2007, 01:16 AM   #2
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,333

Rep: Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547
The problem is probably in the script. Check the script to make sure that all commands use the full path name for the command.

Steve Stites


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
Script to send email... bfloeagle Linux - General 5 10-13-2009 11:20 AM
How to send an email within a script??? johnsanty Programming 19 09-02-2006 01:43 PM
Crontab -e doesnt run my script ! c0nsur Linux - General 4 08-04-2005 12:21 AM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 04:42 AM
script to send email message meluser Programming 2 03-26-2003 01:35 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:09 PM.

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