#!jinja2
[meta]
    title=Task Event Job Log Retrieve

[scheduling]
    [[graph]]
        R1=t1

[runtime]
    [[t1]]
        script="""
wait "${CYLC_TASK_MESSAGE_STARTED_PID}" 2>/dev/null || true
mv "$0.out" "$0.out.keep"
mv "$0.err" "$0.err.keep"
cylc task message 'succeeded' >>"$0.out.keep"
sleep 5
cp -p "$0.out.keep" "$0.out"
cp -p "$0.err.keep" "$0.err"

trap '' EXIT
"""
