pote
asked on
Cron to send e-mail
I need to send e-mail via a cron job.
Basically, I want to have the cron run every Monday, and e-mail a .txt file to a group of people.
I run Linux 5.2
I've tries several crons but no luck.
I could use some help...
Thanks
Pote
Basically, I want to have the cron run every Monday, and e-mail a .txt file to a group of people.
I run Linux 5.2
I've tries several crons but no luck.
I could use some help...
Thanks
Pote
ASKER
The line below sends me a blank mail. It does not pick up the .txt file.
* * * * 1 root /usr/sbin/sendmail aaa@bbb,ccc@ddd < /path/a.txt
Also tried:
* * * * 1 root /bin/cat/ textfile.txt | /usr/sbin/sendmail aaa@bbb,ccc@bbb
Still get a blank e-mail
Help !!
* * * * 1 root /usr/sbin/sendmail aaa@bbb,ccc@ddd < /path/a.txt
Also tried:
* * * * 1 root /bin/cat/ textfile.txt | /usr/sbin/sendmail aaa@bbb,ccc@bbb
Still get a blank e-mail
Help !!
Perhaps a scripts called mail.sh
#!/bin/sh
/bin/mail abc@def < file.txt
/bin/mail def@abc < file.txt
Although
/bin/mail abc@.def def@abc < file.txt
should also works for the above. The cron file should look like
* * * * 1 /usr/local/bin/mail.sh > /dev/nulll 2>&1
#!/bin/sh
/bin/mail abc@def < file.txt
/bin/mail def@abc < file.txt
Although
/bin/mail abc@.def def@abc < file.txt
should also works for the above. The cron file should look like
* * * * 1 /usr/local/bin/mail.sh > /dev/nulll 2>&1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
* * * * 1 root /usr/sbin/sendmail aaa@bbb,ccc@ddd < /path/a.txt
then reread cron file by executing
kill -HUP `cat /var/run/cron.pid'
and here we are ! Waiting for results