Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Verifying last successful rsync (solved)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Bigun
Advocate
Advocate


Joined: 21 Sep 2003
Posts: 2196

PostPosted: Wed Sep 10, 2014 2:59 pm    Post subject: Verifying last successful rsync (solved) Reply with quote

I'm performing offsite back of my home media center, and was wondering how I would capture the last date/time of the last successful rsync.

Last edited by Bigun on Thu Sep 11, 2014 12:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 977
Location: Somewhere in Denmark

PostPosted: Wed Sep 10, 2014 3:25 pm    Post subject: Reply with quote

I got these in /var/log/emerge.log
Code:
1395109202: Started emerge on: Mar 18, 2014 03:20:01
1395109202:  *** emerge  --sync
1395109202:  === sync
1395109202: >>> Synchronization of repository 'gentoo' located in '/usr/portage'...
1395109202: >>> Starting rsync with rsync://[2607:f740:0:29:230:48ff:fef8:a064]/gentoo-portage
1395109296: === Sync completed with rsync://[2607:f740:0:29:230:48ff:fef8:a064]/gentoo-portage
1395109296:  *** terminating.

Just need to convert the epoch timestamp to something a bit more human-readable :)
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Sep 10, 2014 3:40 pm    Post subject: Reply with quote

It's a standard *nix Julian second number. The following little Awk script will interpret it for you:
human-readable-emerge-log.awk:
{
    print strftime("%F %R:%S", $1) gensub("[[:digit:]]+(:.*)$", "\\1", 1);
}
But to see the exact timestamp of the Portage tree at time of last --sync, see "/usr/portage/metadata/timestamp.chk".

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Bigun
Advocate
Advocate


Joined: 21 Sep 2003
Posts: 2196

PostPosted: Wed Sep 10, 2014 3:50 pm    Post subject: Reply with quote

Not an emerge sync... an actual rsync between two machines.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Sep 10, 2014 3:52 pm    Post subject: Reply with quote

Sorry; missed that. I don't think rsync stores that information. Instead, I think it calculates the differences between source and destination on the fly.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Bigun
Advocate
Advocate


Joined: 21 Sep 2003
Posts: 2196

PostPosted: Wed Sep 10, 2014 4:12 pm    Post subject: Reply with quote

John R. Graham wrote:
Sorry; missed that. I don't think rsync stores that information. Instead, I think it calculates the differences between source and destination on the fly.

- John


Is it possible then to detect a 0 exit status then report the time into a file?
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Sep 10, 2014 4:19 pm    Post subject: Reply with quote

Sure. ;) In Bash,
Code:
if command-line-for-your-rsync ; then
    date >some-file
fi
- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Bigun
Advocate
Advocate


Joined: 21 Sep 2003
Posts: 2196

PostPosted: Thu Sep 11, 2014 3:11 pm    Post subject: Reply with quote

John R. Graham wrote:
Sure. ;) In Bash,
Code:
if command-line-for-your-rsync ; then
    date >some-file
fi
- John


Not the cleanest solution, but one can assume if it exits with status 0, it's all good.

*edit*

The result


Last edited by Bigun on Fri Sep 12, 2014 11:19 am; edited 2 times in total
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Thu Sep 11, 2014 5:20 pm    Post subject: Reply with quote

Bigun wrote:
The result

Heh, that is sweet :-)

Do you rsync the pi from a qvm-emu chroot on your machine? (not for backups I mean, for building.)
Back to top
View user's profile Send private message
Bigun
Advocate
Advocate


Joined: 21 Sep 2003
Posts: 2196

PostPosted: Fri Sep 12, 2014 12:33 pm    Post subject: Reply with quote

steveL wrote:
Bigun wrote:
The result

Heh, that is sweet :-)

Do you rsync the pi from a qvm-emu chroot on your machine? (not for backups I mean, for building.)


The system works by my media center at home pushing the data via a SSH rsync session to a remote location where my Pi and an external drive are. I basically perform the sync, if it's successful, it puts the date/time into a file, then performs a sync on that folder so the Pi knows the sync was successful. I then have a Python script checking that file every 30 seconds, then display the info on the LCD.

The buttons on the front can scroll through memory usage, CPU usage, CPU temp, and free space on the external drive. Another set of buttons simply scrolls through the colors that are available through the backlight. And a fifth button is there to either refresh the data with a push, or if it's held in, will shutdown the Pi.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum