From: Sergei <serpiph@pochtamt.ru> To: mandrake-russian@www.altlinux.ru Subject: [mdk-re] Fwd: Скрипт к rsync,версия 2 Date: Thu Mar 29 22:21:14 2001 Message-ID: <01032922300905.04141@pif.b5.mephi.ru> (raw) [-- Attachment #1: Type: text/plain, Size: 121 bytes --] Хочу предложить новую версию скрипта для rsync. Думаю, запустив скрипт, будет все ясно. -- С уважением, Епифанов Сергей [-- Attachment #2: getRE --] [-- Type: text/plain, Size: 1745 bytes --] #!/usr/bin/perl #Общее число попыток (0 - неограничено) $MAX_TRIES=20; #Число повторов скачивания одного и того же файла $MAX_1_TRIES=5; #Текущая попытка $cur_try=0; $cur_1_try=1; #Сайт для скачивания $DownSite="rsync://ftp.altlinux.ru/MandrakeRE/Spring2001"; #Каталог для скачивания $DownDir="/var/ftp/pub/Sisyphus"; #Специальные флаги - НЕ ТРОГАТЬ $RETVAL=1; $WHOHANG=1; #Пользуйтесь как хотите print "Программа скачивания через rsync с несколькими попытками и повторами.\n"; print "Написана 29.03.2001 Епифановым Сергеем, МИФИ.\n"; print "Запуск:\n"; print " getRE сайт каталог_сохранения [число_попыток [число_повторов]]\n\n"; if (defined (@ARGV)) { $DownSite=$ARGV[0]; if (defined ($ARGV[1])) { $DownDir=$ARGV[1]; if (defined $ARGV[2]) { $MAX_TRIES=$ARGV[2]; if (defined $ARGV[3]) { $MAX_1_TRIES=$ARGV[3]; } } } else { print "Недостаточно параметров - нет каталога!\n"; exit; } } else { exit; } #Основной цикл скачивания while ($RETVAL) { #Проверка числа попыток $cur_try++; if ($cur_try>$MAX_TRIES && $MAXTRIES>0) { print "Не хватает попыток ($MAX_TRIES) для полного скачивания, выхожу.\n"; exit; } print "Попытка номер $cur_try\n" if $cur_1_try==1; print "Повтор $cur_1_try попытки $cur_try\n" if $cur_1_try>1; #Запуск скачивания $OldMSG=$NewMSG; $NewMSG=""; $pid=open (OUTINFO,"rsync -avP --timeout=500 --delete-after '${DownSite}' '${DownDir}' |"); while ($line=<UTINFO>) { $NewMSG.=$line; print $line; } if ($NewMSG eq $OldMSG) { $cur_try--; $cur_1_try++; if ($cur_1_try>$MAX_1_TRIES) { print "Исчерпан лимит повторов ($MAX_1_TRIES)\n"; exit; } } else { $cur_1_try=1; } }
reply other threads:[~2001-03-29 22:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=01032922300905.04141@pif.b5.mephi.ru \ --to=serpiph@pochtamt.ru \ --cc=mandrake-russian@altlinux.ru \ --cc=mandrake-russian@www.altlinux.ru \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git