One liner to get the number of seconds since a file was modified:
if [ -f /var/lib/puppet/state/puppetdlock ] ; \
then echo $[`date +%s` - `stat -c %Y /var/lib/puppet/state/puppetdlock`] ; else echo 0 ; fi
The same if statement with line breaks:
if [ -f /var/lib/puppet/state/puppetdlock ]
then
echo $[`date +%s` - `stat -c %Y /var/lib/puppet/state/puppetdlock`]
else
echo 0
fi
No comments:
Post a Comment