LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-11-2012, 06:35 AM   #1
Jamshed Ahmed Qambrani
LQ Newbie
 
Registered: Jun 2012
Posts: 3
Blog Entries: 1

Rep: Reputation: Disabled
How can i scripting on linux which copy folder on server to another


I configured RMAN backup on linux server which is daily scheduled at 9:00PM. Now i need script which copy the rman backup as sunday backup to another server in date format.
suppose today is sunday and backup is take place on 9:00 PM named sunday 10-June-2012. it will autometically copy to another server in date format as below,

source server:

/u02/oracle/RMAN/backup/Sunday


to


Destination server:


/u02/oracle/Backup/10-June-2012


Can anybody suggest me shell scripting to complete this task?

Last edited by Jamshed Ahmed Qambrani; 06-11-2012 at 06:36 AM.
 
Old 06-11-2012, 06:44 AM   #2
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
Rsync:

rsync --rsh="sshpass -p password ssh -l root" ipaddress:/source/* /destination

scp:

sshpass -p 'password' scp root@ipaddress:/source/ /destination


Ftp:
filename="/home/paul/myfile.tar.gz"
hostname="ftp.myhost.com"
username="username"
password="password"
ftp -un $hostname <<EOF
quote USER $username
quote PASS $password

binary
put $filename
quit
EOF

Crontab

30 21 * * * /path/to script -who can above any of method to backup
 
1 members found this post helpful.
Old 06-11-2012, 06:58 AM   #3
Jamshed Ahmed Qambrani
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Thanks Arun,
But it is only simple script.
suppose today is Monay and is 06-Jun-2012 and my rman backup is schedule on 9:00 PM . it takes 10 to 20 minutes to complete. after completing backup it copy to another server this format

/u01/backup/sunday ===> /u01/bcakup/06-June-2012

same like, monday, tuesday, wednesday, thursday and friday

can anybody help me?
 
Old 06-11-2012, 08:17 AM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
dow=`date +%A`

add that as a variable, then put that in the script for your rsync:

rsync --rsh="sshpass -p password ssh -l root" ipaddress:/source/* /destination/${dow}

This will then create a sub-directory with the day of the week as the top directory. this will give you 7 days worth of backups.
 
Old 06-11-2012, 07:25 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,398

Rep: Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780
Use ssh auth-keys; do not put passwds in scripts http://www.linuxtopia.org/online_boo...erate-keypairs
 
Old 06-12-2012, 06:16 AM   #6
Jamshed Ahmed Qambrani
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
I configured RMAN on oracle database 11g and its schedule at 9:00 PM on daily basis. suppose today it run on 9:00 PM and create backup in RMAN Directory Tuesday folder.there are also Sunday and Monday backup are placed in different folders. i want a script which randomly read these folders in RMAN Directory and take tuesday backup to copy to another server to change the folder name from tuesday to date 06-June-2012 format because today is tuesday and date is 12-June-2012.
Can any body help?

Last edited by Jamshed Ahmed Qambrani; 06-12-2012 at 07:20 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using terminal command -Find files in a folder and copy them to a different folder j-jock Linux - General 4 11-28-2011 02:20 AM
Scripts to list folder contents and copy images from folder and subfolders brunces Linux - Newbie 6 11-03-2011 01:23 PM
i need to copy files from one folder to another folder using shell anurupr Linux - Newbie 17 03-04-2010 09:07 AM
want to copy an inode folder from acdrom to a home directory (folder). nhbob Linux - Newbie 8 12-20-2009 11:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration