#! /bin/bash last_wakeup_str=`grep "Enabling non-boot CPUs ..." /var/log/kern.log | tail -n 1 | egrep -o '^.*..:..:..' | head -1` [ -z "$last_wakeup_str" ] && echo -1 && exit 1 wakeup_unix="$(date --date="$last_wakeup_str" +%s)" now_unix="$(date +%s)" delta_s=$(( now_unix - wakeup_unix )) echo "$delta_s" exit 0