aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/aperiodic-upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'share/hydractl/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