#!/bin/bash

DATE=$(date +%m-%d-%Y_%H-%M-%S)

CMD="trace-cmd extract -o trace_${DATE}.dat"
echo ${CMD}
$CMD

#!/bin/bash

TRACE_ENABLED=0

if [ -r /sys/kernel/tracing/tracing_on ]; then
    read -N 1 TRACE_ENABLED < /sys/kernel/tracing/tracing_on
fi

if [ ${TRACE_ENABLED} -eq 0 ]; then
    echo -e "ERROR: Tracing is disabled\n"
    ./trace-cmd-status.sh
    exit -1
fi

DATE=$(date +%m-%d-%Y_%H-%M-%S)

CMD="trace-cmd extract -o trace_${DATE}.dat"
echo ${CMD}
$CMD

Check if tracing is enabled before call trace-cmd extract
Check if tracing is enabled before call trace-cmd extract
