diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-06-29 01:22:07 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-06-29 01:22:07 +0200 |
commit | e00c777b87f847c03c0110c9c58b34cca7151d28 (patch) | |
tree | 0f579fdeedad09a8e1af8a3b62cc53be899912f5 | |
parent | e3111b48ec705c37d19e221c27d78b8febfc402c (diff) | |
download | bin-e00c777b87f847c03c0110c9c58b34cca7151d28.tar.gz bin-e00c777b87f847c03c0110c9c58b34cca7151d28.tar.xz |
sup: Fix shellcheck warnings
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | sup | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -10,9 +10,9 @@ delay=30 times_ran=0 cleanup() { - if [ -n "$pid" ]; then + if [[ -n "$pid" ]]; then echo "killed... $pid" >&2 - kill $pid + kill "$pid" fi exit } @@ -75,23 +75,23 @@ done command=("$@") while :; do - times_ran=$(($times_ran+1)) - if [ $times_ran -gt $delay_after ]; then - echo "sleeping for $delay seconds after $(($times_ran-1)) runs in $delay_reset_after seconds" >&2 - sleep $delay + times_ran=$((times_ran+1)) + if [[ $times_ran -gt $delay_after ]]; then + echo "sleeping for $delay seconds after $((times_ran-1)) runs in $delay_reset_after seconds" >&2 + sleep "$delay" fi - time_started=`date +%s` + time_started=$(date +%s) echo -n "running... " >&2 - ${command[@]} & + "${command[@]}" & pid=$! echo PID: $pid >&2 wait $pid pid="" # reset counter if run long enough - if [ $(($time_started+$delay_reset_after)) -lt `date +%s` ]; then + if [[ $((time_started+delay_reset_after)) -lt $(date +%s) ]]; then times_ran=0 fi done |