24 lines
870 B
Bash
Executable File
24 lines
870 B
Bash
Executable File
#!/bin/bash
|
||
# WAL 哨兵:抓谁动了 state.db-wal
|
||
LOG=~/.hermes/wal-watch.log
|
||
while true; do
|
||
PIDS=$(systemctl --user show hermes-gateway -p MainPID --value)
|
||
if [ -n "$PIDS" ] && [ "$PIDS" != "0" ]; then
|
||
DEL=$(ls -l /proc/$PIDS/fd 2>/dev/null | grep -c 'state.db-wal (deleted)')
|
||
if [ "$DEL" -gt 0 ] && [ ! -f /tmp/wal_alert_sent ]; then
|
||
{
|
||
echo "==== $(date '+%F %T') WAL-DELETED detected, gateway PID=$PIDS"
|
||
ps aux --sort=-%cpu | head -15
|
||
grep -l . /proc/[0-9]*/cmdline 2>/dev/null | while read f; do
|
||
c=$(tr ' |