Information*/알면도움됨

프로세스 종료 확인 shell script

ch4rli3kop 2021. 12. 11. 03:52
반응형

무한 알람

#!/bin/zsh
SERVICE="python3"
while [ 1 ]
do
    #$pid=pgrep "${SERVICE}"
    #echo $pid
    if ! pgrep -xq "${SERVICE}"
    then 
        echo "Process is complete!"
        while [ 1 ]
        do
            say "작업이 완료되었습니다!"
        done
        exit
    else
        echo "Process is running"
    fi
    sleep 3
done
반응형