• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cron job sending email didn't work  RSS feed

 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Was trying to schedule a task using cron to send an email of a log file to myself, but can't seems to get it to work. I'm using Solaris 9. I'm using the root account.

This is how my cron file looks like:
10 17 16 2 * mail emailme@mail.com < /disk01/opt/bea/user_projects/web/application.log

I did stop & start the cron again after I edited the file. I used /etc/init.d/cron stop & /etc/init.d/cron start.

Any help would be much appreciated.

Thanks!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually do it this way
10 17 16 2 * cat /disk01/opt/bea/user_projects/web/application.log | mail emailme@mail.com
[ February 16, 2005: Message edited by: Ben Souther ]
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And like alot commands in Linux/Unix, there are always alternative ways of doing the samething.

Another suggestion is create a script and run it from your cron process:

 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mistake try this:





I hope this helps.
 
Rick Beaver
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cron doesnt know about your $PATH settings - you need to put the full path to all your commands / scripts - e.g. /usr/bin/mail instead of mail
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Thank you very much for all your suggestions & advice. It seems that the Solaris machine that I'm using had not been configured to send out email yet. I'd try to set it up & see if I could get the cron job working.

Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!