Solved

Cron to send e-mail

Posted on 1999-01-20
2
199 Views
Last Modified: 2010-04-20
I need to run a cron job that will mail a .txt file to a group of folks on Monday each week.
I run Linux 5.2. I've tried several crons' but no luck.
I know it's simple, but I'm stumped..!
Any help would be appreciated.
Thanks,
Pote
0
Comment
Question by:pote
2 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1639213
assuming your mail program is  /bin/mail (and it is BSD-style):

59 23 * * Mon /bin/cat file.txt | /bin/mail -s"subject" user@domain.name
0
 
LVL 7

Accepted Solution

by:
HalldorG earned 150 total points
ID: 1639214
Use a script like
#!/bin/sh
/usr/lib/sendmail mailinglist  <<EOF
Subject: the mail every day
From: reply@mydomain.com
To: Mailinglist@mydomain.com

$(cat thetextfile)
EOF
-----------------
And the cron times are the same as abow.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question