From owner-freebsd-questions Sat Mar 15 10:44:36 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E74C537B41C for ; Sat, 15 Mar 2003 10:44:33 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCF6F43FA3 for ; Sat, 15 Mar 2003 10:44:29 -0800 (PST) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b213.otenet.gr [212.205.244.221]) by mailsrv.otenet.gr (8.12.8/8.12.8) with ESMTP id h2FIiQ5u009280; Sat, 15 Mar 2003 20:44:27 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.8/8.12.8) with ESMTP id h2FIiNsH001027; Sat, 15 Mar 2003 20:44:25 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.8/8.12.8/Submit) id h2FGnm0l023943; Sat, 15 Mar 2003 18:49:48 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Sat, 15 Mar 2003 18:49:48 +0200 From: Giorgos Keramidas To: Kenzo Cc: freebsd-questions@FreeBSD.org Subject: Re: cron question Message-ID: <20030315164948.GD20526@gothmog.gr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-RAVMilter-Version: 8.4.2(snapshot 20021217) (terpsi) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2003-03-14 16:08, Kenzo wrote: > I'm trying to automatically create a report in cron and E-mailling it to my > E-mail account. > > this is what I have. > > 0 1 0 0 0 root /usr/bin/perl /usr/local/bin/spamstat.pl /var/log/maillog.0 > > /var/log/spam_report | uuencode spam_report spam_report | mail -s > "spam_daily_report" me@mydomain.com What is 0 1 0 0 0 supposed to do? I am inclined to think you have the time information on that crontab line all wrong. You're redirecting all output from spamstat.pl to the file /var/log/spam_report. Nothing goes down the pipe to uuencode. > what I get is a blanc attachment. > the spam_report file does get created in the /var/log dir with all the right > stuff in it, so I don't get why it won't E-mail it. > I have the same setup for another report and it works fine. > > I know this would probably work better if I created a script to do all this > and have cron run the script, but I don't know how to write any scripts. Just put the commands in /root/spam_report.sh and chmod 755 it.A Try this script: #!/bin/sh /usr/bin/perl /usr/local/bin/spamstat.pl /var/log/maillog.0 | \ uuencode spam_report | \ mail -s "spam_daily_report" me@mydomain.com Then you can make this executable with: # chmod u+x /root/spam_report.sh and call it from /etc/crontab as: 0 1 * * * root /root/spam_report.sh That should work fine :) - Giorgos To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message