You are not logged in.
I have a cronjob that goes like this:
5 0 * * * rsync -avzd --progress --delete --exclude '.wine/drive_c/Program\ Files' --exclude '.wine/drive_c/windows/temp' --exclude '.thumbnails' --exclude 'installs' /home/bobby/ login@website.com:backup/desktop/bobby/ >> /home/bobby/logs/webhomebackup-$(date +%m%d%y_%T).log
Now how can I have a script or some means to email myself when the backup is done?? I really have no scripting skills, hehe. TIA for any help!
P.S. I have mutt/getmail/procmail/sendmail/msmtp set up.
Offline
&& mail -s "backup is done" user@hostname.ext
add something like that at the and of previous line.
Offline
If you change the ">>" to "tee -a" you'll get a copy of the backup log sent via e-mail, too. (Assuming everything is configured correctly for cron to send e-mail to you.)
Offline
Hmm, dang I thought I had my mail setup right, but I think it's working only to receive with mutt. I just tried:
mail -v -s "testing" my@gmail.com
But it just sits there in console hanging, no output or anything. CTRL+C gives me:
^C
(Interrupt -- one more to kill letter)
Then a blitzkrieg of CTRL+C's do nothing, I just kill the window in screen. Here is my ~/.msmtprc:
# gmail
account gmail
host smtp.gmail.com
port 587
protocol smtp
auth on
from me@gmail.com
user me@gmail.com
password pass
tls on
tls_starttls on
tls_trust_file ~/.certs/Equifax_Secure_Certificate_Authority_DER.cer
account default : gmail
What could be wrong? Thanks for the help fellas
Offline
But it just sits there in console hanging, no output or anything.
When you write an email with mail/mailx the last line must finish with a dot (+ RET).
$ mail -s "Greeting" someone@host.com
Hey, I'm writing to say hello!
.
If you don't have a MTA you can setup your ~/.mailrc to relay email trough your ISP.
set smtp=mail.t-com.de
You need to install an RTFM interface.
Offline
Thanks anrxc, I just tried it but apparently I don't have sendmail and I couldn't find it in pacman (only perl-mail-sendmail):
~ # mail -vs "testing" me@gmail.com
testing
.
EOT
/usr/sbin/sendmail: No such file or directory
~ #
what is MTA??
Offline
MTA is mail transport agent - in this case sendmail. Check your logs. gmail may not accept your e-mail because the computer you are on is not a mailserver. I.E. you don't have a MX DNS record. My experience with gmail is that it is sketchy with what it will accept and won't except.
Offline
Whoa, now I'm confused
I thought msmtp was all that was needed to send mail as I'd read on the wiki and some help guides. However above can see that I don't have any sendmail program as it is asking for.
So what do I need to do, create a mail server on my server box?? I'm a tabula rossa in this respect
Offline
Sendmail does not exist as a arch package. Postfix and Exim do (I think). The suggestion about sending mail via your ISP is likely the way you need to go unless you have your own domain and server - in which case you are maintaining your own DNS server. Don't think you are. Because of SPAM, nowadays most mail servers don't accept mail from just any old box on the net.
Start by seeing is you can send mail to users on your localhost. Example: root can send mail to user1 and user1 can reply to root.
Offline
Esmtp is a nice alternative to msmstp which is also able to pass local mail to an MDA such as procmail so that it can be delivered to other users without a full blown MTA such as postfix and sendmail.
Mortuus in anima, curam gero cutis
Offline
Okay so how can I send mail as root? The mail -s "subject" addy@email.com doesn't work of course, what other way do I do??
Offline
if you have msmtp configured correctly, you can use it to send mail instead of using the 'mail' command.
Offline
Thanks anrxc, I just tried it but apparently I don't have sendmail and I couldn't find it in pacman (only perl-mail-sendmail):
Unfortunately Arch doesn't use heirloom's mailx by default (many distributions do). With heirloom-mailx you don't need a MTA, or a forwarder to relay mail to your ISP. Check out this package to replace mailx http://aur.archlinux.org/packages.php?ID=7924 ...if your interested (no real need since you have a forwarder/smtp client already).
You need to install an RTFM interface.
Offline
Dang I just tried msmtp, got this error:
~ # msmtp me@gmail.com
msmtp: cannot set X509 trust file /home/bobby/.certs/Equifax_Secure_Certificate_Authority_DER.cer for TLS session: Base64 decoding error.
msmtp: could not send mail (account default from /home/bobby/.msmtprc)
~ #
I grabbed the file from the equifax site
Offline
Dang I just tried msmtp, got this error:
~ # msmtp me@gmail.com msmtp: cannot set X509 trust file /home/bobby/.certs/Equifax_Secure_Certificate_Authority_DER.cer for TLS session: Base64 decoding error. msmtp: could not send mail (account default from /home/bobby/.msmtprc) ~ #
I grabbed the file from the equifax site
Here's my ~/.msmtprc which works fine with gmail. I installed ca-certificates to get the tls_trust_file.
account default
host smtp.gmail.com
protocol smtp
auth on
password *****
from user@gmail.com
user user@gmail.com
tls on
tls_starttls on
tls_certcheck on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
edit: You may need to run update-ca-certificates to generate the tls_trust_file
Last edited by PeteMo (2008-08-15 19:28:57)
Offline
Okay, I did the update-ca-certificates and edited my ~/.msmtprc as follows:
# gmail
account gmail
host smtp.gmail.com
port 587
protocol smtp
auth on
from me@gmail.com
user me@gmail.com
password pass
tls on
tls_starttls on
tls_certcheck on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account default: gmail
Now I do
msmtp me@gmail.com
And I get a blank line, I type text or try that "." after a return as noted few posts up and I get nothing, it just sits there.
Offline
You can use msmtp as a sendmail replacement for mail (the problem you were having in post #6). Create a ~/.mailrc file and in it place
set sendmail="/usr/bin/msmtp"
. The things suggested above should then work.
Offline
Okay I just did that, but still "msmtp me@gmail.com" just hangs, I try the return with a "." but nothing
Offline
Okay I don't know what's going on, but I have a few rsync backup cmds in my crontab that run at 5am every day and now when I get to the comp I see "You have new mail in /var/mail/bobby" and I can see 2 messages telling me errors in the rsync (those have been fixed hehe). Still however I'm stuck at sending mail as above
Offline