Bug 205755 - portsnap(8) suggestion: add option that shows last time a snapshot was fetched
Summary: portsnap(8) suggestion: add option that shows last time a snapshot was fetched
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-31 12:52 UTC by bkazemi
Modified: 2015-12-31 12:52 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bkazemi 2015-12-31 12:52:47 UTC
Hello,

I have a small script I use to check how long it's been since I've grabbed a snapshot of the ports tree. I figured others might also like being able to get this information via a flag in portsnap.

Here is how I implemented this:
datethen=`cut -f2 -d\| /var/db/portsnap/tag 2>/dev/null`
: ${datethen:?'no tag'}
datenow=`date +%s`
datediff=`expr $datenow - $datethen`
date -r $datethen
echo "$((datediff / 86400)) day(s) $((datediff / 3600 % 24))"\
     "hour(s) since sync."