Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-11-2004, 05:13 AM   #1
LQ Newbie
Registered: Mar 2003
Posts: 17

Rep: Reputation: 0
Howto Monitor elapsed time in a shell script

I have a script that creates a backup for me. I would like to keep track of its progress, so I would like to see, every second (or so), the time elapsed and the size of the backup file. I manage to get the size of the backup file, but I cannot get the elapsed time to work.

This is what i have:

1. To create the backup:

every 1 sys_echosize $tarfile &
tar cfz $tarfile .
kill $every_pid

2. The "every" script performs a cmd every few seconds:

while true ; do
sleep $t

3. The "sys_echosize" is as follows:

echo -e -n " " `du -h $1` "\r"

Nice, isn't it?!?
But not finished, as I would like to have the time elapsed of the tar command...

Any help would be appreciated!!!

Old 03-11-2004, 08:07 AM   #2
Registered: Nov 2003
Location: Northcliffe, WA
Distribution: Slackware 12.0
Posts: 481

Rep: Reputation: 30
check out the time command displays times used to execute another command/script
Old 03-11-2004, 08:46 AM   #3
LQ Newbie
Registered: Mar 2003
Posts: 17

Original Poster
Rep: Reputation: 0
Originally posted by dopefish
check out the time command displays times used to execute another command/script
Thanks! I did, but could not get it working in the above scripts...
Currently, the output is something like:

640M /tmp/fullhd.tgz

And I would like it to be something like (after 4.5 minutes backupping):

640M /tmp/fullhd.tgz (4m:30s)

and (after 5 minutes of backupping):

695M /tmp/fullhd.tgz (5m:00s)

A clou?!?

Last edited by rkrijger; 03-11-2004 at 09:08 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
find elapsed time innuendo_98 Programming 2 11-10-2005 08:03 AM
amarok progressbar time elapsed problem abattoir Linux - Software 0 04-13-2005 10:31 AM
elapsed time formula for open office calc philosophe Linux - Software 1 03-30-2005 05:32 AM
Help with Howto start a shell script at boot draven Linux - Newbie 7 03-03-2004 11:20 PM
getting elapsed time.. Mad_C Programming 2 04-01-2003 01:12 AM

All times are GMT -5. The time now is 04:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration