Added code to only check for updates every 24 hours
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
zshrc
|
||||
.lastcheck
|
||||
|
||||
29
.zshrc
29
.zshrc
@@ -1,9 +1,34 @@
|
||||
# Path to your oh-my-zsh configuration.
|
||||
ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
echo "Updating config"
|
||||
# Update config once every 24 hours
|
||||
cd $HOME/.zcustom
|
||||
git pull
|
||||
case "`uname`" in
|
||||
Linux)
|
||||
STATARGS="-c %Z"
|
||||
;;
|
||||
Darwin)
|
||||
STATARGS="-f %m"
|
||||
;;
|
||||
*)
|
||||
echo "Error! Unknown system `uname`"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [ -f .lastcheck ]; then
|
||||
# if it hasn't been touched in the last 24 hours
|
||||
NOW=`date +%s`
|
||||
LAST=`stat $STATARGS .lastcheck`
|
||||
if [ $(($NOW - $LAST)) -gt 86400 ]; then
|
||||
echo "Updating config"
|
||||
git pull
|
||||
fi
|
||||
else
|
||||
# Doesn't exist
|
||||
touch .lastcheck
|
||||
echo "Updating config"
|
||||
git pull
|
||||
fi
|
||||
cd
|
||||
|
||||
# Aliases
|
||||
|
||||
Reference in New Issue
Block a user