![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sort mail based on subject in unix. | sriram.s | Shell Programming and Scripting | 2 | 02-02-2007 07:38 AM |
| search file, change existing value based on input (awk help) | nortonloaf | Shell Programming and Scripting | 3 | 12-06-2006 01:35 AM |
| Mail based on file size | rajendragora | UNIX for Dummies Questions & Answers | 2 | 07-14-2006 07:53 AM |
| How to grep in order based on the input file | Kelam_Magnus | Shell Programming and Scripting | 2 | 09-24-2002 03:26 PM |
| Saving of UNIX based e-mail on to local disks | rajan9 | UNIX for Advanced & Expert Users | 4 | 08-07-2002 02:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Script based on input mail
Hi,
I am looking for examples of scripts which monitor for a mail from an id , say abc@xyz.com and if that comes, would reply with the contents of a file. The file is a dynamic status of some automated task. Also as variations, I would send the a string as the content of the mail. That would executed and o/p would be replied. Ex:- 'df -k .' would get me the disk status. Any examples are most welcome. Thanks, |
|
||||
|
Sounds like procmail or mailfilter depending on whichever happens to be already installed, or more to your liking. Here's Procmail, for better or for worse: Code:
# Match on envelope sender line (might not work if your MTA is different from mine)
:0
* ^From abc@xyz\.com\>
{
# save a copy for archiving / auditing
:0c:
fromabc
# respond with df -k . output
:0
| ( formail -r ; df -k . ) | $SENDMAIL -t
}
This is very bare-bones and doesn't do any loop control; you'll find safer, better examples in the procmailex manual page. Last edited by era; 05-13-2008 at 03:41 AM.. Reason: Comment that match is on envelope From_ line |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|