#!/bin/sh # # Dump core file and collect more information about crashed process # # BASE='/var/spool/univention-crash-report' if [ -z "${1:-}" ] then install -o 0 -g 0 -m 0700 -d "$BASE" echo "|$(readlink -f "$0") %u %g %p %s %e" >/proc/sys/kernel/core_pattern exit 0 fi user="$1" group="$2" pid="$3" signal="$4" cmd="$5" exe=$(readlink -f "/proc/$pid/exe") time="$(date +%s)" base="${BASE}/${user}_${group}-${signal}-${time}" exec >"${base}.log" 2>&1 ps www -p "$pid" >"${base}.ps" lsof -n -p "$pid" >"${base}.lsof" cat >"${base}.core" exec "${base}.ldd" while read line do for arg in $line do [ -f "$arg" ] || continue dpkg -S "$arg" done done <"${base}.ldd" >"${base}.dpkg-S" cut -d: -f1 <"${base}.dpkg-S" | sort -u | dpkg-query -W "$pkg"> >"${base}.dpkg-W" # vim:set backupcopy=auto: