Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 06-25-2009, 12:11 PM   #1 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default set shell script to show output?

i created a shell script to run multiple rsync commands. I'd like to see the output of these commands in real time....so i know which command it is on.

Is there a way to do this?
office politics is offline  
Old 06-25-2009, 01:38 PM   #2 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: set shell script to show output?

Do you mean tee?
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is offline  
Old 06-25-2009, 02:57 PM   #3 (permalink)
 
Monster Techie

Join Date: Sep 2005

Location: /home/jason

Posts: 1,823

Jayce will become famous soon enoughJayce will become famous soon enough

Send a message via AIM to Jayce
Default Re: set shell script to show output?

I'm not sure if this helps, but I have a bash script with several rsync commands. In my rsync command on each line I tagged in the --progress switch, therefore when I run "backup" from terminal, I can see what the computer is working on.

I rsync to 3 drives. I can't tell which drive is which at the time cause it's going so darn fast, but at least I can get an idea of what the computer is working on at the time.
Jayce is offline  
Old 06-25-2009, 06:48 PM   #4 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: set shell script to show output?

after adding the verbose switch (-v) it started to show relative folder paths.

I'll try adding the progress switch. thanks in advance for the tip Jayce.

now i've created a shell script that you might be able to help with.

it's meant to mount windows shares then use rsync to sync files of particular directories.

it mounts the file share, but exits immediately after...which is when it comes to the for loop.

here's the code....it runs on knoppix

Code:
mkdir /mnt/srv3
mount -t smbfs -o username=office //srv3/cds /mnt/srv3
mkdir /mnt/srv
mount -t smbfs -o username=office //srv/nl /mnt/srv

for (( cd = 1 ; cd > 627 ; cd++ ))
do

echo "Trying cd $cd"

if [$cd < 10]
then

echo "Trying cd $cd"
rsync -av /mnt/srv3/CD000$cd/ /mnt/srv/CD000$cd/

else
  if [$cd < 100]
  then

  echo "Trying cd $cd"  
  rsync -av /mnt/srv3/CD00$cd/ /mnt/srv/CD00$cd/
  
  else
    if [$cd < 1000]
    then
    
    if [$cd > 626]
    then
    
    echo "Trying cd $cd"
    rsync -av /mnt/srv3/CD0$cd/ /mnt/srv/cd0$cd/
    
    fi
    
    echo "Trying cd $cd"
    rsync -av /mnt/srv3/CD0$cd/ /mnt/srv/CD0$cd/
    
    fi
  fi
fi

done

office politics is offline  
Old 06-25-2009, 06:59 PM   #5 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: set shell script to show output?

OK then a few things, you can put your mkdir commands into one eg. mkdir /mnt/{srv,srv3}
you should use cifs insead of smbfs.
Your for loop won't start, maybe you meant this
for(cd = 1; cd < 627; cd++)
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is offline  
Old 06-25-2009, 07:10 PM   #6 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: set shell script to show output?

Quote:
Originally Posted by kmote View Post
OK then a few things, you can put your mkdir commands into one eg. mkdir /mnt/{srv,srv3}
you should use cifs insead of smbfs.

i'll give it a try. what is cifs?


Quote:
Your for loop won't start, maybe you meant this
for(cd = 1; cd < 627; cd++)
rofl, oh man i love it!!!! thx kmote.
office politics is offline  
Old 06-26-2009, 08:46 AM   #7 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: set shell script to show output?

Quote:
Originally Posted by office politics View Post
i'll give it a try. what is cifs?
Honestly I don't really know. I was using smbfs and somewhere along the line I learned that cifs was supposed to be newer/better or something.

Another thing about the code is that
Code:
if [$cd < 1000]
will always be true and
Code:
if [$cd > 626]
will always be false
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is offline  
Old 06-27-2009, 01:51 PM   #8 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: set shell script to show output?

yea, i wrote this in a rush and didn't think hard about the math.


regarding cifs

smbmount(8): mount smbfs filesystem - Linux man page

Quote:
WARNING: smbmount is deprecated and not maintained any longer. mount.cifs (mount -t cifs) should be used instead of smbmount.


i've read cifs is very simialr to server message block "SMB"

Server Message Block - Wikipedia, the free encyclopedia

Download details: Common Internet File System (CIFS) File Access Protocol
office politics is offline  
Old 06-27-2009, 01:55 PM   #9 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: set shell script to show output?

Ah well there you go. I knew I wasn't just pulling that from thin air.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is offline  
Old 06-27-2009, 01:58 PM   #10 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: set shell script to show output?

...the more you know
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch Script Help Please SparkMonkeyHellion Programming Discussions 6 04-17-2009 09:36 AM
Zango Removal Script Osiris Programming Discussions 1 11-27-2008 11:45 AM
batch to copy file help under_score Programming Discussions 6 11-14-2008 08:38 AM
Shell Script bashrc ZeroShade Linux, BSD, other *nixes & Open Source Software 5 08-30-2008 08:26 PM
My log 4uvak HijackThis Logs (finished) 87 01-05-2008 11:17 PM