Commit cc9de6c0 authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Add timestamps in output of run-parts hooks

Prepend a timestamp before every line of output of run-parts hooks,
needed as a quick-n-dirty way to estimate the time taken by each hook to

Refs #1499
parent 7393e7e4
......@@ -71,15 +71,20 @@ fi
RUN_PARTS=$(which run-parts)
if [ -z "$RUN_PARTS" ]; then
log_error "run-parts programe is missing from the system"
log_error "run-parts program is missing from the system"
# If something goes wrong with the tasks, try to umount the target filesystem
# in case it is left mounted...
trap '{ umount "$target"; }' ERR
# Redirect standard error to standard output,
# prepend a timestamp before each line of output.
echo "Execute all snf-image tasks...."
$RUN_PARTS -v --exit-on-error "@tasksdir@"
$RUN_PARTS -v --exit-on-error "@tasksdir@" 2>&1|
while IFS= read -r line; do
echo $(date +%Y:%m:%d-%H:%M:%S.%N) "$line"
# Disable the trap. If code reaches here, the filesystem is unmounted.
trap - ERR
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment