Update grs.sh

This commit is contained in:
Mohammed Goder 2024-03-24 00:27:45 -05:00
parent 6cfd44b100
commit 926c83cbd7

12
grs.sh
View File

@ -28,16 +28,28 @@ for repository in *; do
cd .. cd ..
echo "$log" >> "$logPath" echo "$log" >> "$logPath"
if [ "$gitOutput" == "" ]; then
cd "repositories/$repository"
gitURL=$(git config --get remote.origin.url)
cd ..
rm -rf "$repository"
gitOutput=$(git clone --recursive $gitURL)
cd ..
if [ "$gitOutput" == "" ]; then if [ "$gitOutput" == "" ]; then
log=$(echo [$(date +"%Y-%m-%d %H:%M:%S")] Unable to check for updates to \"$repository\") log=$(echo [$(date +"%Y-%m-%d %H:%M:%S")] Unable to check for updates to \"$repository\")
echo "$log" echo "$log"
echo "$log" >> "$logPath" echo "$log" >> "$logPath"
echo >> "$logPath" echo >> "$logPath"
cp -rf "snapshots/$repository" repositories
cd repositories cd repositories
continue; continue;
fi fi
echo "$gitOutput"
fi
echo "$gitOutput" >> "$logPath" echo "$gitOutput" >> "$logPath"
snapshotSize=$(($(du -sb "snapshots/$repository" | cut -f1) - $(du -sb "snapshots/$repository/.git" | cut -f1))) snapshotSize=$(($(du -sb "snapshots/$repository" | cut -f1) - $(du -sb "snapshots/$repository/.git" | cut -f1)))