Click to See Complete Forum and Search --> : FCron Automatically E-Mail
Dark Ninja
07-15-2004, 01:49 PM
I've searched the web, but can't quite figure out how to accomplish what I want.
I am using fcron as my cron manager. I don't have sendmail installed on my machine. Instead, I have ssmtp.
What I want is to have fcron automatically e-mail me the output of it's cron jobs after they are finished. I had this working before, but I think it was purely accidental. The only thing I can seem to figure out is the file:
/etc/fcron/fcron.conf
Contains a line that points to the sendmail program. I tried switching it to point to ssmtp, but that didn't seem to work. (My cron jobs are running, BTW -- I already checked that.) I also have already setup the ssmtp.conf file -- and that seems to work as well.
I just need to link the two together. (And I don't want to have to code anything in the cron job script to have it e-mail me a file -- especially if the work has already been done.)
Any help? Thanks.
ssmtp foo@bar.com < some_file_to_send
ps: sendmail is a symlink to ssmtp for compatability (qpkg -l ssmtp)
Dark Ninja
07-15-2004, 04:52 PM
Hayl --
Are you saying I need to put this in my cron script? Or, can I setup fcron to automatically use ssmtp?
Sorry...a little confused. It's been a long day.
Thanks
ya, that is the command to mail the contents of a file with ssmtp.
so just change the sendmail command to that basically.
Dark Ninja
07-15-2004, 06:18 PM
Hmmm...well...it looks like everything is setup correctly. Here's my output when I run 'fcrontab -l' as root:
18:05:04 listing root's fcrontab
# /etc/crontab
#
# $Header: /var/cvsroot/gentoo-x86/sys-apps/fcron/files/crontab,v 1.6 2004/04/19 18:35:11 avenj Exp $
# fcron || dcron:
# This is NOT the system crontab! fcron and dcron do not support a system crontab.
# to get /etc/cron.{hourly|daily|weekly|montly} working with fcron or dcron do
# crontab /etc/crontab
# as root.
# NOTE: This will REPLACE root's current crontab!!
# 20 Apr 2002; Thilo Bangert <bangert@gentoo.org>
# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
1 3 * * * rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
*/10 * * * * /usr/bin/test -x /usr/sbin/run-crons && /usr/sbin/run-crons
However, I'm not getting any e-mail. I'm trying to use this tutorial: http://inferno.slug.org/lfs-hints/fcrond-hint.txt and he does have a line that indiciates mailing -- but I'm not sure if that works or not (doesn't seem to). Any other suggestions?
Dark Ninja
07-16-2004, 12:01 PM
Well, since I don't like to leave problems without a solution, here's the solution ot have fcron automatically e-mail you output of cron jobs. (This works in Gentoo, and the link that I previously posted is excellent.)
Basically, you only need to setup two files - /etc/ssmtp/ssmtp.conf and your crontab.
To setup the crontab (for root) run, as root:
# crontab -e
This will open up the root's crontab for editing. Then, add this line to the crontab:
!mailto(root),mail(true)
This will mail files to root, which is an alias located in /etc/ssmtp/revaliases
Then, edit the /etc/ssmtp/ssmtp.conf file. It is well documented, but I just overlooked on part. The first editable line is:
root=postmaster
It should be changed to...
root=[your e-mail address]
That fixed my problem and I now correctly receive e-mails. BTW, if you want more options that you can put into the crontab, check out this website: http://fcron.free.fr/doc/fcrontab.5.html
Hope that helps!