![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| send email from address list and subject list | paulds | UNIX for Dummies Questions & Answers | 2 | 06-27-2008 07:11 AM |
| Email with subject contains value of Variable | deepsingh | Shell Programming and Scripting | 2 | 06-19-2008 01:20 PM |
| How to set Subject in 'mail' ? | hkapil | UNIX for Dummies Questions & Answers | 2 | 10-14-2005 01:36 PM |
| use email subject line as shell command | mskarica | UNIX for Advanced & Expert Users | 4 | 01-31-2005 09:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am profoundly new to *nix, but had a project dropped in my lap that has sparked an interest, leading me here.
I was tasked with daily sending one of our customers a listing of all the spam our filter blocked that was heading for them. Between Google and I; I discovered the Server is running Linux version 2.6.11-gentoo-r4. I learned the basics of grep enough to pare down the amavis.log file to only the pertinent data and figured out how to get it mailed out. I added a crontab to do this daily, and the job was done to the customer's satisfaction. Unfortunately, I cannot leave well enough alone, and decided I wanted to have the email subject include the total blocked messages. grep -c Blocked gives me the total, but I have not been able to track down how to modify the mail subject to reflect this. I attempted to assign n = grep -c Blocked /var/amavis/amavis.log, but $n just echos as grep. Pointing out where I'm screwing up or directing me to a link where I can find the info would be greatly appreciated. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
n=`grep -c Blocked /var/amavis/amavis.log` |
|
#3
|
|||
|
|||
|
Just for an FYI, those are back ticks, and not single quotes. This is on the same key as ~.
|
|
#4
|
|||
|
|||
|
That makes a huge difference, thank you!
So far, I have used email -s "customer spam report" customer@address.sam to deliver the resulting log, which works. My goal is to insert my newly created $n value into the subject, ala' "Customer Spam Report ($n messages)". |
|||
| Google The UNIX and Linux Forums |