todod/utils/verify-db-consistency.sh

27 lines
561 B
Bash
Executable File

#!/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