You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
todod/utils/verify-db-consistency.sh

27 lines
561 B

#!/usr/bin/zsh
if [ $# -ne 1 ] || [ $1 = "-h" ]
then
echo "usage: $0 todod-storage"
exit 0
fi
storage=$1
echo "verify the list-tasks relation: list have tasks, these tasks must exists"
for list in ${storage}/data/lists/indices/by_id/*
do
echo "list: $list"
# echo "Tasks:"
cat $list | jq -r ".tasks[]" | while read task
do
ls ${storage}/data/tasks/indices/by_id/$task.json 2>/dev/null 1>/dev/null
if [ $? -eq 0 ]
then
# echo "- task $task"
else
echo "- task: ${storage}/data/tasks/indices/by_id/$task.json doesn't exist"
fi
done
done