LinuxQuestions.org
Visit Jeremy's Blog.
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-14-2015, 07:15 AM   #1
kzo81
Member
 
Registered: Aug 2014
Location: Hungary
Distribution: Debian, Linux Mint, CentOS
Posts: 197

Rep: Reputation: Disabled
Smile Debugging a bash script - wget, mv


Hi,

Can you please help me find a solution to my script?
Here is the script:

https://github.com/kerzol81/Bash-and...master/syncer2

The bug comes into play when in the while cycle the connection goes away while wget does it's job greatfully. Wget tries 3 times to download from the server, and after that the arranging() function comes in, which also moves the partially downloaded files.

How could it be done to only move those files that have been fully downloaded?

My approach is to use 'mv -u', but there are still chunk files if the connection is instable.

The main problem is that the axis server saves the files in many sub directories, which I don't like, i would like some arrangement after syncronising.

Could I convince somehow wget to keep the partially downloaded files in a diffent place?

Thank you

Z

Last edited by kzo81; 09-14-2015 at 11:56 AM. Reason: more thoughts
 
Old 09-14-2015, 07:38 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
you can use the '-P' option to specify a directory prefix, ie all downloads would go to that directory eg
Code:
wget -P /tmp/zz http://khapplications.darktech.org/bashscripts/simpledump
Would download the file simpledump to /tmp/zz/, the folder must exist first.
 
Old 09-14-2015, 11:31 PM   #3
kzo81
Member
 
Registered: Aug 2014
Location: Hungary
Distribution: Debian, Linux Mint, CentOS
Posts: 197

Original Poster
Rep: Reputation: Disabled
Wink -P

-P which is equivalent to --directory-prefix is already been used in my script. It doesn't solve my problem.
 
  


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
Having trouble with My Bash Script, need Help debugging jdavis_33 Programming 11 12-20-2012 09:59 AM
Bash script debugging issue internetSurfer Programming 4 01-28-2008 08:24 PM
[bash] having trouble debugging this bash script. jons Programming 4 02-08-2007 06:51 AM
Debugging a Bash Shell Script solarblast Linux - General 1 02-23-2006 01:44 AM

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

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