aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-12-17 10:29:13 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-12-17 10:29:13 -0200
commit9d73ff39c0d2c43ab9799ea824698b4f7424c7b8 (patch)
treef9132d3c2e814703ee79cc1d03f2d8f36115dd77
parent71784150d00655e8ebfb65026ea97e2d9dd6fb68 (diff)
downloadhydra-9d73ff39c0d2c43ab9799ea824698b4f7424c7b8.tar.gz
hydra-9d73ff39c0d2c43ab9799ea824698b4f7424c7b8.tar.bz2
Fixes for aperiodic-upgrade
-rwxr-xr-xshare/hydractl/aperiodic-upgrade19
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