LinuxQuestions.org
Help answer threads with 0 replies.
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 12-20-2007, 06:53 AM   #1
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

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


Hello,

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:

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

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

Code:
* * * * * /usr/bin/netpoint_mon
* * * * * /usr/bin/netpoint_mon 2>&1
Also the scripts generates some logs. With the line:
Code:
*/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:

Code:
87ED07A489D     6952 Wed Dec 19 20:40:11  user@host.com
(delivery temporarily suspended: connect to mail.rdsnet.ro[193.231.236.16](This is my smtp): Connection timed out)
                                         user@host.com
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
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,793

Rep: Reputation: 292Reputation: 292Reputation: 292
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
 
  


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
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


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