Progress reporting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Progress reporting
# 1  
Old 05-27-2003
Progress reporting

Hi everyone, I'm completely new to the board and to UNIX and I have the following question regarding a script I am building.

I am trying to copy an entire directory into a new directory and I was wondering if there is any way of printing on screen a progress report, for example a percentage. It doesn't HAVE to be a percentage, but something to that effect (like a count-down) would also do nicely.

Does enyone know how to do this?

Thank you in advance
# 2  
Old 05-27-2003
Can you post your script?
If you are using for loop to loop thru all sub-directories, for copying, then keep directory count and display that count as process indicator.

Regards,
Yeheya
# 3  
Old 05-27-2003
here's the crucial bit


if test -f /u/ttc/
then #File or directory exists so ask for confirmation

echo -n "Ready to begin copy, continue? [y/n]"; read choice
if [ "$choice" -eq y ] || [ "$choice" -eq Y]; then echo "Copying files"
cp -r $livecomp $copycomp
mv -r $livecomp $tempcomp

As you see, I'm not using a for loop...
# 4  
Old 05-27-2003
Well, this isn't a countdown, but if all you want is to show that progress is being made, you could always include an echo command in your code..
Code:
cp -r $livecomp $copycomp
mv -r $livecomp $tempcomp
echo -n "."

After each file is moved, a dot will appear on the screen, giving output like this:
............
# 5  
Old 05-28-2003
that would be fine, except there are several thousand files that have to be moved and it's usually left overnight and checked remotely.... :/

Would it be possible to do a file count and then show a file count down? eg 'File xxxx of xxxx coppied'

Just a thought from the old BASIC days
# 6  
Old 05-28-2003
Quote:
if test -f /u/ttc/
then #File or directory exists so ask for confirmation

echo -n "Ready to begin copy, continue? [y/n]"; read choice
if [ "$choice" -eq y ] || [ "$choice" -eq Y]; then echo "Copying files"
cp -r $livecomp $copycomp
mv -r $livecomp $tempcomp
if [ test -f /u/ttc/ ]
then
echo "Ready to begin copy, continue? [y/n]" ; read choice

if [ "$choice" -eq y ] || [ "$choice" -eq Y]
then
DIR_COUNT=`wc -l /u/ttc/`
TOTAL=$DIR_COUNT
echo "Directory Count is ${DIR_COUNT}. Begining Copy"

while [ $DIR_COUNT -gt 0 ]
do
echo " Copying file $DIR_COUNT of $TOTAL"
cp -r $livecomp $copycomp
mv -r $livecomp $tempcomp
let DIR_COUNT=$DIR_COUNT-1
done

Check syntax as I just quickly typed this out..there are better ways to do this, this is just to give you an idea of how to go about implementing your fix. You may also want to invest in some error checking following the copy command (unless of course you are running as root). Also, you may want to change the -eq to = since you are comparing a string an not an integer. Another point would be to log the events in your script (which Im sure you are doing Smilie )

Last edited by google; 05-28-2003 at 09:30 AM..
# 7  
Old 05-28-2003
thanks man, I'll test it Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

How to disable an error reporting ???

Hi A few days ago I attached an usb external disk to a server running AIX, then I removed it without typing any commands. Now, the server can't find the usb device and it keeps reporting the errors every 3 hours, like this 55479D40 0112080017 T H usbms0 ADDITIONAL INFORMATION... (2 Replies)
Discussion started by: bobochacha29
2 Replies

2. UNIX for Advanced & Expert Users

Reporting last login details

Most of my Solaris 10 user accounts are generally 10 characters long. When I run the 'last' command the report only shows the first 8 characters so the information is not very helpful. How can I report the full 10 character user account. (1 Reply)
Discussion started by: PPOWER55
1 Replies

3. SCO

du and dfspace reporting

Hi, I am using SCO UNIX version 6.0.0 release 5. I am using du and df space to see the used space in the / partition. I am using du -k option to get count in 1024 k so that it directly makes kb. In dfspace I subtracted the used mb from total size mb which should be the used space and then... (40 Replies)
Discussion started by: dextergenious
40 Replies

4. Solaris

Monitoring and Reporting Solutions

Hi, I am hunting for a low cost Monitoring & Reporting Tool for the SUN Environment. I have all and all SUN Environment with LDOMs, Zones. The monitoring Tool 1. Hardware failure. 2. Disk space and failure. 3. LDOMS,Zones. 4. CPU,Memory Utilization. 5. ping,URL Monitors 6. Send... (4 Replies)
Discussion started by: menonk
4 Replies

5. Shell Programming and Scripting

Disk space reporting

I need to accomplish the following task - I have a number of accounts for a number of applications that i deploy on a unix server. There are a number of directories for each account in /prod/apps directory. eg. For an account Application1 I have /prod/apps/Application1_1 /prod/apps/Application1_2... (4 Replies)
Discussion started by: niranjandighe
4 Replies

6. Solaris

sar command not reporting

I am running Solaris 10 in a sparc environment. I have the sys crontab setup to use sar to gather data and report it. My sys crontab entry looks like this: 0,5,10,15,20,25,30,35,40,45,50,55 * * * 0-6 /usr/lib/sa/sa1 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e... (2 Replies)
Discussion started by: RobSand
2 Replies

7. UNIX for Dummies Questions & Answers

SNMP time reporting

Hi, First post, please bare with me. I am currently using SNMP on Nagios to monitor Exim and all is running great with the exception to it picking up the date / time of the last Exim queue run. What I am hoping to achieve is for SNMP / Nagios to correctly pickup the difference between the... (1 Reply)
Discussion started by: theblueproject
1 Replies

8. Shell Programming and Scripting

Reporting SU and Failedlogins

Hi:- I am working on an audit report that produces a monthly summary of account activity on a particular AIX host. I am struggling with su activity and failed logins as these tend to come back with more then a month's data. Is there a easy way that these files can be rotated/cleaned out on a... (1 Reply)
Discussion started by: janet
1 Replies

9. UNIX for Dummies Questions & Answers

Reporting

I have to do a lot of reporting for the company that I work for and was wondering if anyone had suggestions for a way to create professional looking reports. I currently use Filepro so much that I rarely see the shell. Any help is appreciated. (3 Replies)
Discussion started by: Mike11
3 Replies
Login or Register to Ask a Question