| 1 | #!/bin/bash |
| 2 | |
| 3 | if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then |
| 4 | exit |
| 5 | fi |
| 6 | |
| 7 | color_warn='\E[1;33m' |
| 8 | color_reset='\E[0m' |
| 9 | color_bold='\E[1m' |
| 10 | |
| 11 | lttng_processes="$("$1" 'lttng|gen-ust-.+' -a | grep -v "$(basename "$0")")" |
| 12 | |
| 13 | if [ $? -eq 0 ]; then |
| 14 | pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')" |
| 15 | |
| 16 | echo -e "${color_warn}Warning: the following LTTng processes were detected running on the system:$color_reset" |
| 17 | echo |
| 18 | echo "$lttng_processes" |
| 19 | echo |
| 20 | echo -e "Here's how to kill them: ${color_bold}kill -9 $pids$color_reset" |
| 21 | echo -e "${color_warn}If you leave them alive, some tests could fail.$color_reset" |
| 22 | echo |
| 23 | fi |