LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-28-2012, 09:38 AM   #1
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
auto updating a script question (rsync or wget or ...?)


i have a backup script that runs on hundreds of servers all over the US. id like to put it up on a central site (web page) and use either rsync or wget or some other function to have the servers check for an update. If there is a newer vs for their chain to grab the update, rename it, change the permissions to +x and move forward with the newer script.

I have no clue on even were to start on something like this.

The reason for the rename is although the script is basically the same there are slight changes like e-mail address, path, user/pw combo etc. This is a simple backup script for encrypting and then FTP data out to a local NAS. Each chain of stores has their own unique information.

on the server the script is named:

nasftp.sh (simple right)

on the web server id like to name it something along the line:

nasftp.chain1
nasftp.chain2
etc...

I hope i made this semi clear.

Thanks in advance.
 
Old 09-28-2012, 01:03 PM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 424
Blog Entries: 28

Rep: Reputation: 2
You are better off placing the backup file in a ftp server for both security and convenience measures:
then use ftp and use mget/get to grab the file to local server. Packages like gftp, ftp should work.
Ted
 
Old 09-28-2012, 01:41 PM   #3
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
i was thinking about having the script check the web page for a vs difference and then grab it only if it is needed. this allows for better automation, vs manually pushing things down.

is that possible with mget or other ftp options? i have not done anything like either automated. so far as just pushing files around well that is the easy part.
 
Old 09-28-2012, 01:44 PM   #4
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 424
Blog Entries: 28

Rep: Reputation: 2
yes absolutely, ftp can check last mod date to compare for a newer version. If you simply use wget to compare the difference, there may be concerns that you are comparing a newer copy to an older copy, overwriting the newer with a older one.
 
Old 09-28-2012, 01:52 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
ahh nice, could you point me in a direction to do this with ftp as i currently have the files on a ftp server. i just have been manually downloading them to each server. takes way to long to log into server, log into ftp site and download file, verify the proper script is in place, log out, wash repeat for 100 stores in a day.
 
Old 09-28-2012, 01:59 PM   #6
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 424
Blog Entries: 28

Rep: Reputation: 2
what dist are you using? And are your remote files placed in a ftp server? I probably need to get a bit more information to help you with the codes. (PM me if the credentials concern you)
Ted
 
Old 09-28-2012, 02:06 PM   #7
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
i have the most current files residing on our corp. FTP server.

the remote servers are all RH types (FC5, FC7, CentOS 5.4, and CentOS 6.2)

I currently use nfctp in a little script to quickly get to our ftp server, otherwise just ftp/lftp all seem to work without issue.
 
Old 09-28-2012, 02:21 PM   #8
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 424
Blog Entries: 28

Rep: Reputation: 2
if lftp works, then connect to your remote server with lftp providing host, user and pass while in lftp mode
Code:
mirror -n [source] [target]
http://linux.die.net/man/1/lftp see mirror section.
Ted
 
Old 09-28-2012, 02:44 PM   #9
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
well here is what i ended up with:

Code:
[103236_rx30@rx30 ~]$ chmod +x nasftp.sh
[103236_rx30@rx30 ~]$ lftp -e "set ftp:passive-mode on && cd rayb && mirror -n nasftp.usave nasftp.sh && bye" -u XXXXXXX,XXXXXXXX ftp.XXXXXXXX.com
cd ok, cwd=/rayb
mirror: Access failed: 550 /rayb/nasftp.usave: Is a file.
1 error detected
 
Old 09-28-2012, 03:54 PM   #10
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
hmm changed it up a bit and still getting the : Is a file. error:

Code:
[103236_rx30@rx30 ~]$ lftp -e 'mirror -an nasftp.usave /usr/rx30/nasftp.sh' -u XXXXXXX,XXXXXXXX ftp.XXXXXXX.com/rayb/
cd ok, cwd=/rayb
mirror: Access failed: 550 /rayb/nasftp.usave: Is a file.
1 error detected
now what? i just want a single file, not an entire directory worth.
 
Old 10-01-2012, 08:39 AM   #11
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
from what i gather lftp mirror will only work with a directory, not a single file. ill keep looking.
 
Old 10-01-2012, 09:43 AM   #12
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,051

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
for the sake of security and automation have you thought about using ssh with keys ?

you can run commands and transfer files using the built-in ssh/scp. or you could mount the remote directory with sshfs.
 
Old 10-01-2012, 09:49 AM   #13
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
sadly the corp. FTP server is running on IIS. go figure we are a linux support company that runs our backend on MS... rolls eyes.
 
  


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
Bash Auto Download Script for Podcasts available (wget used) O(V)eGA_l2el) Linux - General 1 01-04-2012 09:15 PM
[SOLVED] Using wget to download images and updating to capture new ones from link Using Debian Linux - Newbie 2 02-19-2011 09:58 PM
wget script question sidkdbl07 Programming 1 10-28-2010 04:18 PM
Question on rsync script, not doing what it should be doing... JockVSJock Programming 5 01-03-2010 03:07 PM
wget and auto resuming after disconnect GT I.N.C Linux - Software 6 05-10-2003 07:45 AM


All times are GMT -5. The time now is 02:57 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