diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-12-17 10:29:13 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-12-17 10:29:13 -0200 |
commit | 9d73ff39c0d2c43ab9799ea824698b4f7424c7b8 (patch) | |
tree | f9132d3c2e814703ee79cc1d03f2d8f36115dd77 /share/hydractl | |
parent | 71784150d00655e8ebfb65026ea97e2d9dd6fb68 (diff) | |
download | hydra-9d73ff39c0d2c43ab9799ea824698b4f7424c7b8.tar.gz hydra-9d73ff39c0d2c43ab9799ea824698b4f7424c7b8.tar.bz2 |
Fixes for aperiodic-upgrade
Diffstat (limited to 'share/hydractl')
-rwxr-xr-x | share/hydractl/aperiodic-upgrade | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/share/hydractl/aperiodic-upgrade b/share/hydractl/aperiodic-upgrade index 1b0f649..505c309 100755 --- a/share/hydractl/aperiodic-upgrade +++ b/share/hydractl/aperiodic-upgrade @@ -34,16 +34,21 @@ if [ ! -e "$LOG" ]; then hydractl upgrade else LAST="`cat $LOG`" - INTERVAL="$(($DATE - $LAST))" - # More than $TIMEFRAME? - if (( $INTERVAL > $TIMEFRAME )); then - echo hydractl upgrade + if [ -z "$LAST" ]; then + hydractl upgrade else - echo "Please enjoy life for an additional $(($TIMEFRAME - $INTERVAL)) seconds before running this command again." - exit + INTERVAL="$(($DATE - $LAST))" + + # More than $TIMEFRAME? + if (( $INTERVAL > $TIMEFRAME )); then + hydractl upgrade + else + echo "Please enjoy life for an additional $(($TIMEFRAME - $INTERVAL)) seconds before running this command again." + exit + fi fi fi # Save timestamp -$DATE | $sudo tee $LOG > /dev/null +date +%s | $sudo tee $LOG > /dev/null |