Koozali.org: home of the SME Server

Legacy Forums => General Discussion (Legacy) => Topic started by: p1ur on May 15, 2004, 04:58:33 PM

Title: Automatic weekly mail
Post by: p1ur on May 15, 2004, 04:58:33 PM
Hi'
I have a sme-server at my home, and I'm loving it  :-)
So thanx to contribs and all you guys & dolls.

I'm hoping you and my sme-server can help with a little task I have.
Every Sunday I must send 2 e-mails to one specific e-mail-address. One in the morning, and one in the afternoon. Every Sundag the same 2 messages.

I have been looking at cron, but to tell the truth, I cannot figure out what to do, can anyone help me?

Petur
Title: Automatic weekly mail
Post by: duncan on May 15, 2004, 06:43:00 PM
Rough - There is alot more to this script

#!/bin/bash

cat /root/catfiles/myobbackup.txt | mail someone@somewhere.com -s "Backup has been performed"

The body of the message is in /root/catfiles/myobbackup.txt the subject is  Backup has been performed

The script is run from cron
Title: Automatic weekly mail
Post by: p1ur on May 19, 2004, 11:39:27 PM
It doesn’t work.

I have done the following to test whether or not I can make it work:
I have put a file in /etc/cron.daily/
With the name: send-indledn
Containing:
#!/bin/bash
cat /home/e-smith/files/ibays/test-ibay/files/send-indledn.txt | mail me@my-mail.com -s “indledning”

Now I get a daily mail with the subject: Cron <root@server> run-parts /etc/cron.daily
containing:

/etc/cron.daily/send-indledn:

/usr/bin/run-parts: /etc/cron.daily/send-indledn: /bin/bash
: bad interpreter: No such file or directory

I am obvious doing something wrong, but I haven’t got a clue
Can anyone give me one?

Thanx in advance

Petur
Title: Automatic weekly mail
Post by: duncan on May 20, 2004, 12:20:48 AM
I use another script to kick off the backup script

#!/bin/bash
# Perform Myob backup

/etc/backup/myob/myobbackup> /dev/null

It lives in /etc/cron.daily.

You would also need to do "chmod 0755 scriptname" to both to make them executable.