You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
223 B

#!/usr/bin/env bash
IFS='
'
PID=$(jobs -l %1 | grep -Eo '[\+\-] [0-9]+' | grep -Eo '[0-9]+')
LOG_FILE="exp.log"
while kill -0 "$PID" 2> /dev/null; do
echo $(date +"%F %T") - $(jobs %1) >> "$LOG_FILE"
sleep 1
done