美文网首页
2018-05-20 trAP EXIT

2018-05-20 trAP EXIT

作者: QT4CN | 来源:发表于2018-05-20 16:09 被阅读0次

    #!/bin/bash

    #pid=$(jobs -p)

    #echo "pid is $(jobs -p)"

    d="+[%Y-%m-%d %H:%M:%S]"

    trap 'kill $(jobs -p) 0' EXIT

    (

    if flock -n 9; then

    while true; do

    echo "testjobs" ; date

    sleep 3

    done

    fi

    ) 9> /var/lock/test.lock 3>&2 2>&1 | (while read ; do echo $(date "$d") "$REPLY" ; done )

    相关文章

      网友评论

          本文标题:2018-05-20 trAP EXIT

          本文链接:https://www.haomeiwen.com/subject/fmdtjftx.html