mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-09 13:38:05 +08:00
🔥 Sync 2026-07-19 20:20:12
This commit is contained in:
1 parent
8570b2d838
commit
0e974e420a
29 files changed
+1161
-1032
No files matched your search
@@ -121,9 +121,12 @@ if [ "$fail" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
if [ "$count" -gt 0 ] && [ "$ok" -gt 0 ] && /bin/pidof daed >/dev/null 2>&1; then
|
||||
log "restarting daed to apply updated subscriptions"
|
||||
if ! /etc/init.d/daed restart >>"$LOG" 2>&1; then
|
||||
fail 8 "daed restart failed after subscription update"
|
||||
run_body="$TMPDIR/run.json"
|
||||
run_resp="$TMPDIR/run.out"
|
||||
printf '{"query":"mutation Run($dry:Boolean!){run(dry:$dry)}","variables":{"dry":false}}' > "$run_body"
|
||||
log "applying updated subscriptions"
|
||||
if ! post_graphql "$run_body" "$run_resp" "$token" || grep -q '"errors"' "$run_resp"; then
|
||||
fail 8 "failed to apply updated subscriptions: $(cat "$run_resp" 2>/dev/null)"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -61,10 +61,15 @@ fi
|
||||
rc=1
|
||||
else
|
||||
size=$(wc -c < "$TMP" 2>/dev/null || echo 0)
|
||||
if [ "$size" -lt 102400 ]; then
|
||||
magic=$(hexdump -n 1 -e '1/1 "%02x"' "$TMP" 2>/dev/null)
|
||||
if [ "$size" -lt 1024 ]; then
|
||||
echo "$(date '+%F %T') file too small ($size bytes)"
|
||||
rm -f "$TMP"
|
||||
rc=2
|
||||
elif [ "$magic" != "0a" ]; then
|
||||
echo "$(date '+%F %T') invalid geodata format"
|
||||
rm -f "$TMP"
|
||||
rc=3
|
||||
else
|
||||
mv "$TMP" "$DEST"
|
||||
echo "$(date '+%F %T') updated $DEST ($size bytes)"
|
||||
|
||||
Reference in new issue
Block a user