On Monday, August 20, 2012 03:29:05, Stephan Seitz wrote: > On Sun, Aug 19, 2012 at 07:59:00PM -0400, Chris Knadle wrote: > >Related note: I likewise repeatedly have confusion over how to deal with > >testing Network Status from within shell scripts for doing operations that > >require network access. As a "for instance" a common suggestion for > >keeping GPG keys up to date is to set a 'gpg --referesh-keys' operation > >as a cron job, which doesn't make sense to do if the device the script is > >run on is offline, > > And how do you want to do this check? Even if ethtool says, the interface > is up, this doesn’t mean, your DSL router has a WAN connection running. > And if it has, it doesn’t mean you can reach the keyserver. > > So you can use something like „fping -q <keyserver>”, if the keyserver is > pingeable. Any other check is not really usefull. Basically you've got the idea of what I'm doing. ~/bin/gpg-refresher ------------------- # (this setting pulled in from a config file) PING_LOCATION=www.yahoo.com #(actual location should = keyserver location) # ping -c 3 $PING_LOCATION > /dev/null if [ "$?" -ne "0" ]; then exit fi gpg --refresh-keys -o - 2>&1 | fgrep -v -e "requesting key" \ -e " not changed" -e "Total number processed: " -e " unchanged: " \ -e " keys processed so far" -e " next trustdb check due at" \ | egrep -v -e "refreshing .* keys from " \ -e "key .* not found on keyserver" \ -e "^gpg: depth: .*" -e " trust model$" -- Chris -- Chris Knadle Chris.Knadle@coredump.us GPG Key: 4096R/0x1E759A726A9FDD74
Attachment:
signature.asc
Description: This is a digitally signed message part.