×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Copying Wrong Data

Copying Wrong Data

Copying Wrong Data

(OP)
Hello Everyone, I am having a very odd thing happening I can't recall I have ever had this happen. I need to copy data from one Linux server to another from several different mount points. (i.e /0c, /0d, /0e). I wanted to set up a bash script to copy a fresh copy each day and run the script off hours. below is the script the script is being run on the destination server. I did a pwd and echo just to verify I was in the correct directory and running the correct command for testing. When the script runs it only copies the /root directory contents to each mount point and not the data that's actually in the mount points but, if I run the command manually on the destination server from the command line everything works fine. To run the command manually on the destination server I cd to the mount point on the server the and run the command " ssh ussaif08 'find /0c | cpio -o' | cpio -idmv > /dev/null 2>&1 ". Any help would be greatly appreciated thanks in advance.

for sMntPt in `cat /root/TstDataMntPts.txt`
do

cd $sMntPt
pwd
echo "Cmd to run ssh ussaif08 'find $sMntPt | cpio -o' | cpio -idmv > /dev/null 2>&1"

ssh ussaif08 'find $sMntPt | cpio -o' | cpio -idmv > /dev/null 2>&1

done

RE: Copying Wrong Data

Environment variables are not translated within single quotes, only double quotes. try this...

CODE

for sMntPt in `cat /root/TstDataMntPts.txt`
do

    cd $sMntPt
    pwd
    echo "Cmd to run ssh ussaif08 \"find $sMntPt | cpio -o\" | cpio -idmv > /dev/null 2>&1"

    ssh ussaif08 "find $sMntPt | cpio -o" | cpio -idmv > /dev/null 2>&1

done 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close