ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Download and Delete from Source every 5 minutes (Ubuntu)

    IT Discussion
    5
    34
    8.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by

      Well you'd have to have the script check for any new files, and compare the source vs the destination.

      So you could have it check every 30 seconds or whatever schedule you'd want.

      1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403 @Jstear
        last edited by

        @Jstear said in Download and Delete from Source every 5 minutes (Ubuntu):

        This sounds like a good use case for Rsync. Setup a cron job to run rsync every X amount of minutes.

        rsync would work perfectly for this as well, cron is for scheduled tasks.

        1 Reply Last reply Reply Quote 1
        • S
          Sparkum
          last edited by

          No problem using rsync with a ftp I assume?

          scottalanmillerS 1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403
            last edited by

            There shouldn't be any issues.

            1 Reply Last reply Reply Quote 0
            • S
              Sparkum
              last edited by

              Alright think I've got it

              So mount my drives with fstab and then just a simple

              rsync --remove-source-files -options /path/to/src/ /path/to/dest

              dafyreD scottalanmillerS 2 Replies Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403
                last edited by DustinB3403

                I believe the function you want is --delete-after . But otherwise, yeah that should work.

                Nope ignore me remove-source-files would be better.

                1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller @Sparkum
                  last edited by

                  @Sparkum said in Download and Delete from Source every 5 minutes (Ubuntu):

                  @DustinB3403
                  Would there be a way to script it in that it checks, if it sees the file the same (source vs remote) that it deleted?

                  Yes, that would not be too hard. MD5 hash stored in a text file to compare against would work. But you need an MD5 on the remote site to be able to compare against. Otherwise, it needs to download it to check the hash.

                  1 Reply Last reply Reply Quote 0
                  • scottalanmillerS
                    scottalanmiller @Sparkum
                    last edited by

                    @Sparkum said in Download and Delete from Source every 5 minutes (Ubuntu):

                    No problem using rsync with a ftp I assume?

                    Rsync and FTP are different protocols. The term "using rsync with FTP" is meaningless. Imagine saying "using email with a phone call." What does that even mean?

                    Rsync and FTP are competing options. You can only use the technologies that the site you are downloading from provides. If they only offer FTP, you can only use FTP, it's that simple.

                    1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller
                      last edited by

                      Let's start with the source, what is the actual source of this data. And why do you need it every five minutes? This is a weird task and I think we need to understand the real goals to really know what is and isn't a reasonable approach.

                      1 Reply Last reply Reply Quote 0
                      • dafyreD
                        dafyre @Sparkum
                        last edited by

                        @Sparkum said in Download and Delete from Source every 5 minutes (Ubuntu):

                        Alright think I've got it

                        So mount my drives with fstab and then just a simple

                        rsync --remove-source-files -options /path/to/src/ /path/to/dest

                        Seems that this would be a good option.

                        1 Reply Last reply Reply Quote 1
                        • S
                          Sparkum
                          last edited by

                          I'm trying to mount the drive under /etc/fstab but I cant seem to get it to work.

                          I have my local windows drive mounted, just cant get the remote Ubuntu drive mounted.

                          I'm assuming my problem child will either be firewall or port, does anyone know what port mounting the drive takes on Ubuntu?

                          scottalanmillerS 1 Reply Last reply Reply Quote 0
                          • scottalanmillerS
                            scottalanmiller @Sparkum
                            last edited by

                            @Sparkum said in Download and Delete from Source every 5 minutes (Ubuntu):

                            I'm trying to mount the drive under /etc/fstab but I cant seem to get it to work.

                            I have my local windows drive mounted, just cant get the remote Ubuntu drive mounted.

                            I'm assuming my problem child will either be firewall or port, does anyone know what port mounting the drive takes on Ubuntu?

                            What is the mounting protocol in question?

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              Sparkum @scottalanmiller
                              last edited by

                              @scottalanmiller

                              Trying to mount using /etc/fstab

                              So I'm doing...

                              //XXX.XXX.XXX.XXX/var/www/completed /mnt/ftp cifs username=root,password=PASSWORD,iocharset=utf8,sec=ntlm,dir_mode=0777,file_mode=0777 0 0

                              but I'm getting error code 115

                              So I'm wondering if there's a certain port that needs to be opened up, or a typical thing that has to be done when connecting to remote computers (both ubuntu 14.04)

                              dafyreD scottalanmillerS 2 Replies Last reply Reply Quote 0
                              • dafyreD
                                dafyre @Sparkum
                                last edited by

                                @Sparkum said in Download and Delete from Source every 5 minutes (Ubuntu):

                                @scottalanmiller

                                Trying to mount using /etc/fstab

                                So I'm doing...

                                //XXX.XXX.XXX.XXX/var/www/completed /mnt/ftp cifs username=root,password=PASSWORD,iocharset=utf8,sec=ntlm,dir_mode=0777,file_mode=0777 0 0

                                but I'm getting error code 115

                                So I'm wondering if there's a certain port that needs to be opened up, or a typical thing that has to be done when connecting to remote computers (both ubuntu 14.04)

                                Can you run the mount commands by hand and have it work?

                                1 Reply Last reply Reply Quote 0
                                • scottalanmillerS
                                  scottalanmiller @Sparkum
                                  last edited by

                                  @Sparkum said in Download and Delete from Source every 5 minutes (Ubuntu):

                                  @scottalanmiller

                                  Trying to mount using /etc/fstab

                                  So I'm doing...

                                  //XXX.XXX.XXX.XXX/var/www/completed /mnt/ftp cifs username=root,password=PASSWORD,iocharset=utf8,sec=ntlm,dir_mode=0777,file_mode=0777 0 0

                                  but I'm getting error code 115

                                  So I'm wondering if there's a certain port that needs to be opened up, or a typical thing that has to be done when connecting to remote computers (both ubuntu 14.04)

                                  Why are you using CIFS between Linux machines? This seems like it is being treated in a very complicated way for something that should be really simple.

                                  1 Reply Last reply Reply Quote 0
                                  • scottalanmillerS
                                    scottalanmiller
                                    last edited by

                                    Why are you not just using Rsync?

                                    S 1 Reply Last reply Reply Quote 0
                                    • S
                                      Sparkum @scottalanmiller
                                      last edited by

                                      @scottalanmiller

                                      Because thats what was suggested below, thats about it.

                                      And what should I use to mount between linux machines?

                                      scottalanmillerS 1 Reply Last reply Reply Quote 0
                                      • dafyreD
                                        dafyre
                                        last edited by

                                        NFS tends to work better between Linux boxes.

                                        scottalanmillerS 1 Reply Last reply Reply Quote 0
                                        • scottalanmillerS
                                          scottalanmiller @Sparkum
                                          last edited by

                                          @Sparkum said in Download and Delete from Source every 5 minutes (Ubuntu):

                                          @scottalanmiller

                                          Because thats what was suggested below, thats about it.

                                          And what should I use to mount between linux machines?

                                          Who suggested that? CIFS would be the worst option. Rsync the best. NFS in the middle.

                                          Only NFS between LInux machines. But we need to back up. Why are you mounting anything? Mounting sounds like the wrong approach here. Hence why I keep saying Rsync instead of mounting.

                                          1 Reply Last reply Reply Quote 0
                                          • scottalanmillerS
                                            scottalanmiller @dafyre
                                            last edited by

                                            @dafyre said in Download and Delete from Source every 5 minutes (Ubuntu):

                                            NFS tends to work better between Linux boxes.

                                            A LOT better...

                                            • Native libraries.
                                            • Faster
                                            • More stable
                                            • Must less to configure
                                            • No weird permissions mismatches
                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post