Skip to content

Commit 24b585f

Browse files
committed
checkContext (unfinished...)
1 parent 302db63 commit 24b585f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

addon_files/redmatic/bin/checkContext

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#/bin/sh
2+
3+
ADDON_DIR=/usr/local/addons/redmatic
4+
5+
source $ADDON_DIR/home/.profile
6+
7+
CONTEXT_DIR="`jq -r '.contextStorage.file.config.dir' $ADDON_DIR/etc/settings.json`"
8+
9+
check() {
10+
FILE=$1
11+
if [ -f $FILE ]; then
12+
echo "checking $1" # | logger -p daemon.info -t redmatic
13+
TYPE=`jq -r -e type $1 2> /dev/null`
14+
if [ $? != 0 ] || [ -z $TYPE ] || [ $TYPE != "object" ]; then
15+
echo "$1 corrupted." # | logger -p daemon.err -t redmatic
16+
fi
17+
fi
18+
19+
20+
}
21+
22+
if [ -d "$CONTEXT_DIR/context" ]; then
23+
export check
24+
find "$CONTEXT_DIR/context" -name \*.json | while read file; do check "$file"; done
25+
fi

0 commit comments

Comments
 (0)