Time duration from one command to another
Hi. I have made a shell script as below to find that how much time is taking between one command to another.
echo weekly backup started `date '+%Y-%m-%d/%k-%M'` > /var/log/backup/weekly.log tar -cjvf something.tar.bz2 /directory echo weekly backup completed `date '+%Y-%m-%d/%k-%M'` >> /var/log/backup/weekly.log If I cat the content of /var/log/backup/weekly.log file the actual time is taken 5 hours 30 minutes for compressing and given 38GB *.bz2 file. But for sending that 38GB *.bz2 file to some other server it is taking around only 25 minutes. for that the shell script as below echo weekly backup sending to someserver `date '+%Y-%m-%d/%k-%M'` > /var/log/backup/nfsweekly.log scp /directory/*.bz2 root@IP_Addr:/directory echo weekly backup sent to someserver `date '+%Y-%m-%d/%k-%M'` >> /var/log/backup/nfsweekly.log But I found only 29GB size in another server instead of 38GB. So there is a suspection of 2nd shell script, becuase if I realy use scp command insted of script it will take more than hour. In another server lot of free space is there where I am sending *.bz2 file. Although the file size is only 29GB instead of 38GB. So how can I made changes that only then that 3rd command(echo weekly backup sent to someserver `date '+%Y-%m-%d/%k-%M'` >> /var/log/backup/nfsweekly.log) should execute when 2nd(scp /directory/*.bz2 root@IP_Addr:/directory) command is successfully completed. |
Sorry but I've some difficulty to get what you are doing.
1. You create a tar.bz2 file. (which is one file only right? or you split the file?) 2. Then, I lost you... :( Can you please clarify your issue? Thanks, Angel. Please number your step so it will be easier to follow you. |
Can time commands separately
You can always use the time command to get the exact time taken by a command:
Code:
time tar -cjvf something.tar.bz2 /directory Just prepend time before the command you want to clock... |
Code:
echo weekly backup started `date '+%Y-%m-%d/%k-%M'` > /var/log/backup/weekly.log But for sending that 38GB *.bz2 file to some other server it is taking around only 25 minutes. for that the shell script as below Code:
echo weekly backup sending to someserver `date '+%Y-%m-%d/%k-%M'` > /var/log/backup/nfsweekly.log ciao, jdk |
All times are GMT -5. The time now is 08:56 AM. |