Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Posts
    78

    Unanswered: How to create scp script?

    Hi everyone,

    I need to create a script that will scp DB2 backup files greater than 3 days from one server to another. The only problem is that the DB2 databases get backed up using the db2 instance and we sudo to the instance hence we don't know the password. Is there anyway to send it using a user id? any help would be greatly appreciated. I am running DB2 V9 on a Linux Intel platform. Thanks again.

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You can use ssh to run a "find" command and identify all the files you want to copy via scp. Then you feed the result through a loop and grab each file.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Dec 2007
    Posts
    78
    Thank you. Sorry i a newbie when it comes to shell scripts would you happen to have the syntax?

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Have a look at the man pages of ssh, scp, and find.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  5. #5
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    talk to your UNIX admin and see if they can NFS mount directory from another server so you can simply move file there.

    find put_your_original_dir_here -type f -mtime +3 -exec mv {} put_your_dist_dir_here \;

    it will be a one line script.

    And do what Stolze said as well
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •