Commit | Line | Data |
---|---|---|
70076186 MJ |
1 | #!/bin/bash |
2 | # | |
3 | # SPDX-FileCopyrightText: 2018 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com> | |
4 | # | |
5 | # SPDX-License-Identifier: GPL-2.0-or-later | |
6 | ||
7 | set -exu | |
8 | ||
9 | pids=() | |
10 | ||
11 | # Kill any LTTng-related process | |
12 | lttng_processes="$(pgrep -l 'lttng|gen-ust-.+')" || true | |
13 | if [ -n "$lttng_processes" ]; then | |
14 | echo "The following LTTng processes were detected running on the system and will be killed:" | |
15 | echo "$lttng_processes" | |
16 | ||
17 | # Build the pids array | |
18 | while read -r pid; do | |
19 | pids+=("$pid") | |
20 | done < <(cut -d ' ' -f 1 <<< "$lttng_processes") | |
21 | ||
22 | kill -SIGKILL "${pids[@]}" | |
23 | fi | |
24 | ||
25 | # Remove any coredump already present | |
26 | find "/tmp" -name "core\.[0-9]*" -type f -delete || true |