On 12/20/18 3:10 PM, CLOSE Dave wrote:
> I have a script that uses rsync to pull the Fedora repositories nightly.
> If I run it manually, it works flawlessly. But if it runs via cron, I
> get an error on all the Fedora 28 repositories. I do not get the error
> on Fedora 27 or RPMFusion 27 or 28 repositories. The script sets timeout
> values to 3600 seconds but fails in only a few seconds. (I haven't
> started to sync F29 repos yet.)
> 
> The error message is,
> 
>   rsync: safe_read failed to read 1 bytes [Receiver]: Connection reset
> by peer (104)
>   rsync error: error in rsync protocol data stream (code 12) at
> io.c(276) [Receiver=3.1.3]
> 
> The commands in the script are,
> 
>   # cat mirror
>   #!/bin/sh
>   /root/bin/mirror-fedora-27
>   /root/bin/mirror-fedora-28
>   /root/bin/mirror-rpmfusion-27
>   /root/bin/mirror-rpmfusion-28
> 
> And the F28 subordinate script is,
> 
>   # cat mirror-fedora-28
>   #!/bin/sh
>   opt="-aHv --timeout=3600 --contimeout=3600 --exclude=repoview/**"
>   opt+=" --usermap=:apache --groupmap=:apache --exclude=0ad-*"
>   opt+=" --exclude=/*/armhfp/** --exclude=debug/**"
>   opt+=" --exclude=repoview/** --exclude=*.html"
>   opt+=" --exclude=/*/SRPMS/**  --delete-excluded"
>   src="rsync://mirrors.kernel.org/fedora"
>   dst="/var/www/html/pub/fedora/linux"
>   r="releases"; u="updates"; s="Server"; e="Everything"; w="Workstation"
>   doit () {
>     mkdir -p $dst/$3
>     rsync $opt $src/$2 $dst/$3
>   }
>   doit "$e x86_64" $r/28/$e/x86_64/os/ $r/28/$e/x86_64/os
>   doit "$s x86_64" $r/28/$s/x86_64/os/ $r/28/$s/x86_64/os
>   doit "$w x86_64" $r/28/$w/x86_64/os/ $r/28/$w/x86_64/os
>   doit "$u x86_64" $u/28/$e/x86_64/    $u/28/$e/x86_64/os
> 
> Other scripts are similar with the obvious substitutions.

Running interactively but not under cron usually indicates that you've
forgotten that running under cron, you don't have the same environment
as you do in an interactive session. So, make sure your environment is
set correctly in the script (such as the PATH and such). Just for
giggles, try creating a script:

        #!/bin/bash
        env >/tmp/environ.txt

Run it from the command line look at the content of /tmp/environ.txt.
Then run it again as a cron job and look at the output. You'll see the
differences.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ri...@alldigital.com -
- AIM/Skype: therps2        ICQ: 226437340           Yahoo: origrps2 -
-                                                                    -
-                Huked on foniks reely wurked for me!                -
----------------------------------------------------------------------
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to