Choose style:

Author Topic: Creating a synced backup  (Read 6803 times)

0 Members and 1 Guest are viewing this topic.

Offline rmcellig

  • Member
  • ***
  • Posts: 207
  • Karma: 14
  • New Forum User
    • View Profile
Re: Creating a synced backup
« Reply #15 on: April 14, 2014, 02:10:58 pm »
Thanks! Do you know if it is possible to be notified by email when an rsync j as completed successfully?

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26466
  • Karma: 2882
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Creating a synced backup
« Reply #16 on: April 14, 2014, 04:57:39 pm »
you could run rsync from a script, and have it mail you depending on the generated exit code.

There's a script on this page:
http://barbz.com.au/blog/?tag=rsync
that look like it should do the trick.

Spoiler (click here to view / hide)
Code: [Select]
#! /bin/bash -l
temp=error.`date '+%m%d%Y_%H%M%SGMT'`
rsync -az from/here to/here > $temp 2>&1
if [ $? -eq 0 ] 
then
    echo "Rsync was successfull" |
    mailx -s "Rsync was successfull" -r replyto@gmail.com toaddress@gmail.com
else
    cat $tempfile |
    mailx -s "Rsync was NOT successfull" -r replyto@gmail.com toaddress@gmail.com
    rm -rf $temp
fi
[close]

Obviously it needs a little editing :)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec