X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=extras%2Fcore-handler%2Fhandler.sh;h=631df9d647e33b140f0c6ff545f097574afe0235;hp=781728223bd64b50355a022bc0cf8d24a1348e5c;hb=24de704ea32ddb8841624555457b9c46816090b0;hpb=c071ccd98cbd98e5f49a6b6f691e21a578c8a14e diff --git a/extras/core-handler/handler.sh b/extras/core-handler/handler.sh index 781728223..631df9d64 100755 --- a/extras/core-handler/handler.sh +++ b/extras/core-handler/handler.sh @@ -1,27 +1,14 @@ #!/bin/sh # -# Copyright (C) 2013 - Christian Babeux +# Copyright (C) 2013 Christian Babeux # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; only version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# SPDX-License-Identifier: GPL-2.0-only # # System binaries paths. CAT_BIN="cat" PGREP_BIN="pgrep" MKDIR_BIN="mkdir" -LTTNG_BIN="lttng" # Session name SESSION_NAME="coredump-handler" @@ -29,6 +16,12 @@ SESSION_NAME="coredump-handler" # Sessiond binary name. SESSIOND_BIN_NAME="lttng-sessiond" +# TODO: Checking for a sessiond lockfile would be more appropriate. +if $PGREP_BIN -u root "${SESSIOND_BIN_NAME}" > /dev/null 2>&1 +then + $LTTNG_BIN snapshot record -s ${SESSION_NAME} > /dev/null 2>&1 +fi + # Core file settings. CORE_PATH="/tmp/lttng/core" CORE_PREFIX="core" @@ -54,9 +47,3 @@ $CAT_BIN - > "${CORE_PATH}/${CORE_PREFIX}.$p" # Optional, chain core dump handler with original systemd script. #$CAT_BIN - | /usr/lib/systemd/systemd-coredump $p $u $g $s $t $e - -# TODO: Checking for a sessiond lockfile would be more appropriate. -if $PGREP_BIN -u root "${SESSIOND_BIN_NAME}" > /dev/null 2>&1 -then - $LTTNG_BIN snapshot record -s ${SESSION_NAME} > /dev/null 2>&1 -fi