Skip to content

Instantly share code, notes, and snippets.

@apetenchea
Created March 28, 2023 16:23
Show Gist options
  • Save apetenchea/6d6c275efcffaa5e8769df3a5d61692d to your computer and use it in GitHub Desktop.
Save apetenchea/6d6c275efcffaa5e8769df3a5d61692d to your computer and use it in GitHub Desktop.
Generate core dumps for all arangod processes
#!/bin/bash
if [ $# -eq 0 ]; then
proc="$(ps aux | grep arangod | grep -v grep)"
else
proc="$(ps aux | grep arangod | grep -v grep | grep $1)"
fi
echo "$proc" > ps.txt
while IFS= read -r line; do
pid=$(echo "$line" | cut -f 3 -d " ")
gcore -o "core.arangod" "$pid"
done <<< "$proc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment