Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm a newbie with linux scripts so please go easy....
I'm using the following script on a centos 6 server to rsync a centos mirror to my own local mirror:
Quote:
#!/bin/bash
while [ 1 ]
do
/usr/bin/rsync -art --delete -vv --progress rsync://mirror.nsc.liu.se/centos-debuginfo/6/x86_64/ /var/www/html/debug.info/6/x86_64
if [ "$?" = "0" ] ; then
echo "rsync completed normally"
exit
else
echo "Rsync failure. Backing off and retrying..."
sleep 20
fi
done
this script works well in that it auto resumes rsyncing when the connection is broken. What I want to do however is make this process run for a set amount of time and then stop the rsync process and clean exit. Is there a way to do this?
I've tried putting this in at various aplaces:
Quote:
killall -SIGTERM rsync
exit 0
but it doesn't work, the script just carries on.
I've also tried the script this way:
and it does stop after 20 secs but it's messy, it doesn't clean exit and it doesn't contain any auto resume. What I ultimately want to do is run this script as a cron job during the night so it starts, runs for a set time and then stops clean and exits. Is there a way to have both these things in one script? Thanks for any help.
but my problem is this:
I have a monthly download limit imposed by my isp, and the volume needed to build up a local mirror eats it away. However downloading between midnight and 8am isn't counted so I use a cron job to download during these hours, but so far it's messy trying to stop one download and start another during the night. I'm getting errors and failures to download.
Better to diagnose the "errors and failures" and once those are corrected, schedule it as a late night cronjob, no?
What errors and failures are you getting?
60.4'ish G of data in that remote directory.
Do you have room for that?
the failures are because (using the second script) the internet connection sometimes gets broken and the stop and exit from the script is messy. The first script solves these problems, but the first script doesn't have a time limit in it - which I would like, if I could get some help on how to correctly script it.
I don't think that site allows rsync into that directory.
This however works for me here:
Code:
cd /var/www/html/debug.info/6/x86_64
lftp -c "open http://mirror.nsc.liu.se/centos-debuginfo/6/x86_64/ ; mirror"
and seems to supports a resume-type function
I watched a stat command on one of the existing files and killed the job and restarted it and the file *times weren't changed at all.
ok thanks but I'm fairly certain the problem here is in the script I'm using, not in the site I'm downloading from. The stop and clean exit has to be done using a time limit in the script (preferably in the first script I mentioned) not from a human pressing keys on the keyboard.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.