Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Commit

Permalink
stats + optimisations
Browse files Browse the repository at this point in the history
  • Loading branch information
montyanderson committed Sep 17, 2019
1 parent 2604e6e commit a009c63
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
34 changes: 28 additions & 6 deletions github_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ function users_from_file() {
done

echo "Backing up user: ${user}"
get_user_repos $user
download_user_repos $user
#get_user_repos $user
#download_user_repos $user

storage=$(du "./" -d0 | awk '{print $1;}');
redis-cli set "stats:storage" "$storage"

files=$(find "." "!" -name '.*' -type f | wc -l);
redis-cli set "stats:files" "$files"
done
}

Expand Down Expand Up @@ -64,15 +70,31 @@ function download_user_repos() {
# force pull
echo "Updating ${name}...";
cd $name;
git pull -f;
cd ../../;

# if changes exist
if git checkout master &&
git fetch origin master &&
[ `git rev-list HEAD...origin/master --count` != 0 ] &&
git merge origin/master
then
# zip new update
echo 'Updated';
cd ../../;

zip -r "$name.zip" $name
else
echo 'Not updated'
cd ../../;
fi
else
# clone from scratch
echo "Cloning ${name}...";
git clone $url $name;
fi

zip -r "$name.zip" $name
cd ../../;

zip -r "$name.zip" $name
fi

done

Expand Down
2 changes: 2 additions & 0 deletions sync_users.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
curl "http://localhost:8000/actorlogins" | ./github_repos.sh -

0 comments on commit a009c63

Please sign in to comment.