hi
i have written a script whose output is getting mailed to me using crontab what i want it to do is mail it to someone else.

this is what iam doing.
37 01 24 1 * /usr/local/bin/perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/compare.pl | mail -s "file compare output " rishi83@yahoo.in(not real)

but rishi83@yahoo.in is not getting the mail.any suggestions.
also can i mail the output to more than one person(email).

You're pretty much there. I usually use sendmail, so pardon the substition.

I think it's either output redirection or the mail command, but this should work (assuming your command works when run at the command line!)

37 01 24 1 * (echo "Subject: file compare output";/usr/local/bin/perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/compare.pl 2>&1)|/usr/lib/sendmail rishi83@yahoo.in

iam recieving a mail on my inbox with a warning
Warning: missing newline at end of file /tpf106/data2/cis_web/cis3/cis3.11/approved/s-branch/src/content/cv/cis/cong/subjlist1/hier.cv

i have send the file as an attachment.
thanks cheers.

also you can specify multiple recievers to output of a cronjob.separated by this ','.

im on debian etch, and I have a very simply mail shell script that just pipes du to sendmail. It works on its own. but when i run it via cron it doesn't seem to finish. I set a cron log, just says its run. Ports open, and the script works from shell just fine. I have it running ever 1 minute for testing, and nodda.... Any ideas please let me know.


Here is crontab -e:
*/1 * * * * /mattscripts/du

Here is script:
#!/bin/sh
#echo off
du -hsc /mattupload/1TB/* | sendmail notify@

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.