Page MenuHomec4science

repo-lock.sh
No OneTemporary

File Metadata

Created
Thu, May 9, 02:11

repo-lock.sh

#!/bin/bash
function req {
ssh c4science-db01 "mysql -B -e \"$@\"" 2> /dev/null
}
repo=$(req 'select FROM_UNIXTIME(r.epoch), r.syncWait, r.repositoryPHID, a.name from repository_syncevent as r, phabricator_almanac.almanac_device as a where r.properties like "%lock%" and r.devicePHID=a.phid group by r.repositoryPHID,a.name order by epoch desc limit 10;;' | tail -n +2)
if [ -z "$repo" ]; then echo "Nothing to do.. exiting"; exit; fi
while read -r r; do
TS=$(echo "$r" | cut -f1 | jq -r '.epoch')
if [ $TS -lt $(($(date +%s)-300)) ]; then # older than 5 minutes
echo "$r" | cut -f2,3
fi
done <<< "$repo"

Event Timeline