Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

3 Answers 3

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
1  
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

 
discard

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.