Never done this, but with text files you should look at mail(1).
It supports input from std in, and has escape sequences with which
you can add commands to the input.
1.)Try createing a here file composed of the file you want to send, with command that insert subject, recipients, etc.
2.)At the time of sending archive the old file by renaming it, maybe add a date string. Then at the next run only the recent (since last run) inputs will be used, then archive this file too. Don't know if thats possible for you're setup.
Another possibility would be to count the lines contained in the file at the time of sending using wc(1), then count the number of lines at the next run, calculate the difference and use tail(1) to extract the lines since last send.
|