Skip to content

Commit

Permalink
checkContext (unfinished...)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Mar 6, 2021
1 parent 302db63 commit 24b585f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions addon_files/redmatic/bin/checkContext
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#/bin/sh

ADDON_DIR=/usr/local/addons/redmatic

source $ADDON_DIR/home/.profile

CONTEXT_DIR="`jq -r '.contextStorage.file.config.dir' $ADDON_DIR/etc/settings.json`"

check() {
FILE=$1
if [ -f $FILE ]; then
echo "checking $1" # | logger -p daemon.info -t redmatic
TYPE=`jq -r -e type $1 2> /dev/null`
if [ $? != 0 ] || [ -z $TYPE ] || [ $TYPE != "object" ]; then
echo "$1 corrupted." # | logger -p daemon.err -t redmatic
fi
fi


}

if [ -d "$CONTEXT_DIR/context" ]; then
export check
find "$CONTEXT_DIR/context" -name \*.json | while read file; do check "$file"; done
fi

0 comments on commit 24b585f

Please sign in to comment.