commit c8ab6a9f0c3df8ec1766f91348eee99a9730288c parent f375766166d8fd3b348c252e0c1a31f31c512ea1 Author: Antoine Amarilli <a3nm@a3nm.net> Date: Fri, 26 Jan 2018 10:37:53 +0100 end date, +TODO Diffstat:
throttle | | | 13 | ++++++++++--- |
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/throttle b/throttle @@ -16,7 +16,7 @@ if [ ! -f "$FILE" ] then echo 0 > $FILE fi -LAST=$(tail -1 $FILE) +LAST=$(tail -1 $FILE | cut -d' ' -f1) PRESENT=$(date "+%s") DIFF=$(($PRESENT - $LAST)) @@ -40,6 +40,13 @@ then fi # run command -date "+%s" >> $FILE -exec "$@" +date "+%s # start" >> $FILE +"$@" +CODE="$?" +# store the end date +# TODO should be a signal because we don't close cleanly +date "+%s # stop" >> $FILE + + +exit "$CODE"