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
|
zshrc
|
||||||
|
.lastcheck
|
||||||
|
|||||||
27
.zshrc
27
.zshrc
@@ -1,9 +1,34 @@
|
|||||||
# Path to your oh-my-zsh configuration.
|
# Path to your oh-my-zsh configuration.
|
||||||
ZSH=$HOME/.oh-my-zsh
|
ZSH=$HOME/.oh-my-zsh
|
||||||
|
|
||||||
echo "Updating config"
|
# Update config once every 24 hours
|
||||||
cd $HOME/.zcustom
|
cd $HOME/.zcustom
|
||||||
|
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
|
git pull
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Doesn't exist
|
||||||
|
touch .lastcheck
|
||||||
|
echo "Updating config"
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
cd
|
cd
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
|
|||||||
Reference in New Issue
Block a user