Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to measure the time it takes to backup a PostgresSql database, I know I can do time pg_dump ...., but what if I already launched the pg_dump command?.

The process already took more than half an hour, and I don't want to break it right know. I'm pretty sure it will take one more hour (and I'll be at home at that time). I would like to know tomorrow how much time it took.

share|improve this question
up vote 4 down vote accepted

You are writing this to file, do you? File modification time would be your answer.

share|improve this answer
Yes!, thanks that's what I was looking for. – Leonardo Ramé Jun 14 '12 at 20:31
simple answers are always awesome. – Hyppy Jun 14 '12 at 20:43

Just show start time

ps -ax  -o cmd,lstart | grep pg_dump

Or timestamp

ls --time-style=+%s -ld /proc/PROCESS_PID

Or secs elapsed

ls --time-style=+%s -ld /proc/PROCESS_PID | cut -d " " -f6 | \
xargs echo "`date +%s` - $1" | bc
share|improve this answer

find the pid of your process, say it 999

run this:

while ps -p 999 -o pid; do  date; sleep 20; done

in a shell. the above will quit when your process is done.

you can sleep more if granularity you want is bigger.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.