<div dir="ltr">Thanks for all your tips!<br><br>I found that the information is basically available in &#39;last -x&#39;.<br><br>Below is  a rough script I put together to estimate total times rounded to hours:<br><br>Thanks,<br>

-tom<br><br>--------------------------------<br><br>#!/bin/bash<br><br><br>#<br># Compute total hours machine has been running, minus time it was turned off.<br># Based on output from &#39;last -x&#39;<br>#<br><br><br>STOP_F=/tmp/stop<br>

START_F=/tmp/start<br><br>last -x |awk &#39;/shutdown/ {print $5, $6, $7, $8}&#39; |tac  &gt; $STOP_F<br>last -x |awk &#39;/reboot/ {print $5, $6, $7, $8}&#39;  |tac &gt; $START_F<br># Start times (should be 1 more than shutdown times):<br>

<br># get rid of 1st start line since machine is still up<br>sed -i &#39;1d&#39; $START_F<br><br>#<br># Read 1 line from each file and compare<br># (see redirection at end of while loop<br>#<br>while read STOP &lt;&amp;8<br>

do<br>        read START &lt;&amp;7<br><br>        # compute time machine was stopped<br>        start_s=$(date -d &quot;$START&quot; +%s)<br>        stop_s=$(date -d &quot;$STOP&quot; +%s)<br><br>        ((duration = start_s - stop_s))<br>

        ((tot_hours = duration / (60*60) ))<br><br>        echo total hours stopped = $tot_hours<br>        ((saved_hours+=tot_hours))<br><br>done 7&lt;$START_F 8&lt;$STOP_F<br><br>#<br># Compute total uptime since first boot<br>

#<br><br># seconds at 1st boot<br>first_s=$( date -d &quot;$(last |tail -1 | awk &#39;{$1=&quot;&quot;; $2=&quot;&quot; ;print }&#39;)&quot; +%s)<br>now_s=$(date  +%s)<br><br>((elapsed_hours= (now_s - first_s) /(60*60) ))<br>

echo Total elapsed hours = $elapsed_hours<br>echo Saved hours = $saved_hours<br>echo Total charged hours = $((elapsed_hours - saved_hours))<br></div>