LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 08:38 AM   #1
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 12:03 PM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
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, 12:41 PM   #3
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 12:44 PM   #4
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
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, 12:52 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 12:59 PM   #6
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
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, 01:06 PM   #7
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 01:21 PM   #8
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
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, 01:44 PM   #9
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 02:54 PM   #10
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 07:39 AM   #11
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
from what i gather lftp mirror will only work with a directory, not a single file. ill keep looking.
 
Old 10-01-2012, 08:43 AM   #12
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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, 08:49 AM   #13
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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



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 08:15 PM
[SOLVED] Using wget to download images and updating to capture new ones from link Using Debian Linux - Newbie 2 02-19-2011 08:58 PM
wget script question sidkdbl07 Programming 1 10-28-2010 03:18 PM
Question on rsync script, not doing what it should be doing... JockVSJock Programming 5 01-03-2010 02:07 PM
wget and auto resuming after disconnect GT I.N.C Linux - Software 6 05-10-2003 06:45 AM

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

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