LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 01-17-2012, 01:26 PM   #1
nelovicov
LQ Newbie
 
Registered: Jan 2012
Location: in Angola, City Luanda
Posts: 8

Rep: Reputation: Disabled
Unhappy tar the last periodic backup that is in another path and move the tar to some dir


I want to make a script that have to take "get or mv" the tar file from another path. The script make a tar of the last periodic backup (PB). The PB have the same name with diferent date. When the script find the last PB make a tar and move the tar file in other path. Could some one help, please?
 
Old 01-17-2012, 01:30 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Hi,

Show us what you have written already, and where you are stuck.

Kind regards
 
Old 01-17-2012, 01:54 PM   #3
nelovicov
LQ Newbie
 
Registered: Jan 2012
Location: in Angola, City Luanda
Posts: 8

Original Poster
Rep: Reputation: Disabled
Question

For this part I haven't nothing, 'cause I have three machine. I take archives in one to put in another, 2nd one, for this I use a perl script. Then I want to take the periodic backup and put this in the same dir with the archives that came from 1st machine. Then I'll make a tar of this dir and put in the 3rd machine. I just make an experience using "find -mtime", but is not what I looking for.

$ftp = Net::FTP->new($ftp_server1, Passive => 1) or die "unable to connect: $@\n";
$ftp->login($ftp_uid1, $ftp_pw1) or die "unable to login: $@\n";
$ftp->cwd($ftp_dir) or die "Cannot change working directory ", $ftp->message;
$ftp->binary;

$ftp->get($ftp_file1) or die "Cannot list directory ", $ftp->message;
$ftp->get($ftp_file2) or die "Cannot list directory ", $ftp->message;

$ftp->quit;

Last edited by nelovicov; 01-17-2012 at 01:56 PM.
 
Old 01-18-2012, 12:43 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Well, that code looks basically ok; what happens when you run it?
Obviously it needs some code to get/set vars first, but just to test you can hardcode them.
 
Old 01-19-2012, 09:12 AM   #5
nelovicov
LQ Newbie
 
Registered: Jan 2012
Location: in Angola, City Luanda
Posts: 8

Original Poster
Rep: Reputation: Disabled
I didn't put all the code. but I set vars first. But this script is only to get the files there need to put in the 2nd machine using FTP. Now I want to tar the last periodic backup and move it to some directory. Could some one help. how can I do it?
 
Old 01-19-2012, 06:24 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
If you want to do it purely in Perl, try this module http://search.cpan.org/~bingos/Archi...Archive/Tar.pm
Otherwise, you could make an external call with qx or system http://perldoc.perl.org/perlop.html#...Like-Operators or try open2 & open3 http://perldoc.perl.org/IPC/Open2.html or try 'piped open' http://perldoc.perl.org/perlipc.html...%28%29-for-IPC
 
Old 01-20-2012, 10:40 AM   #7
nelovicov
LQ Newbie
 
Registered: Jan 2012
Location: in Angola, City Luanda
Posts: 8

Original Poster
Rep: Reputation: Disabled
no, I don't want to make it using perl, I want to use shell script, 'cause my machine is using an old solaris version and in perl archives I don't have the tar.pm... I made a download of it and put it in the right directory, but is not working...
 
  


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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
"Invalid tar magic" error msg. when I try to tar ldmud *.tar file in DSL pixxi451 Linux - Newbie 4 07-04-2010 09:32 AM
Backup My Home Dir Using Tar? carlosinfl Linux - General 2 03-19-2008 02:30 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM

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

All times are GMT -5. The time now is 03:13 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration