Skip to content

Instantly share code, notes, and snippets.

@jiskanulo
Forked from anonymous/keep-fetching.sh
Last active February 2, 2016 04:09
Show Gist options
  • Save jiskanulo/875a1181ce695981a366 to your computer and use it in GitHub Desktop.
Save jiskanulo/875a1181ce695981a366 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
dir=$(cd ${1:-.} && pwd)
if [ $? -ne 0 ] || [ ! -d "$dir" ] || [ ! -w "$dir" ]; then
echo "$dir can not writable directory, abort."
exit 1
fi
cd $dir
git status --short > /dev/null
if [ $? -ne 0 ]; then
exit 1
fi
sleep_time=${2:-60}
if [ $sleep_time -le 0 ]; then
sleep_time=60
fi
while :; do
git fetch
echo -n "."
sleep $sleep_time
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment