Jul 4, 2013

I want to know when a running process will terminate. How can I watch it?

http://askubuntu.com/questions/313138/i-want-to-know-when-a-running-process-will-terminate-how-can-i-watch-it
while [ -d /proc/ ]; do sleep 1; done; echo "Process finished at $(date +"%F %T")."
Or you can make a bash script:
#!/bin/bash

if [ ! -d /proc/$1 ]; then
    echo "Process $1 doesn't exist."
    exit 1
fi

while [ -d /proc/$1 ]; do
    sleep 1
done

echo "Process $1 finished at $(date +"%F %T")."

No comments: