• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Cron pattern to copy over a USB drive

    How-To
    3
    24
    9.2k
    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.
    • phildunlapP
      phildunlap
      last edited by

      Hi sky_watcher,

      You shouldn't have to worry about mounting the USB drive with fstab as Fox suggested - V3 Mango ES units have usbmount installed to facilitate the USB Utilities actions. It will mount the first USB stick plugged in at /media/usb0

      After that, your choices are

      1. Set Mango to backup directly to the USB drive instead of to the /opt/mango/backup folder. This is in the system settings
      2. Set up a cron pattern as Fox suggested and add that to a crontab either via crontab -e to invoke the script or simply add the script /etc/cron.daily/ (and then you don't need to generate the cron pattern but you have less control).
      3. Set a schedule in Mango and use event handlers to copy / move files as necessary.
      S 1 Reply Last reply Reply Quote 2
      • MattFoxM
        MattFox
        last edited by phildunlap

        Thanks Phil!
        Wasn't entirely sure on if fstab was applicable but felt it was good enough to mention for how a linux fs works at least.

        Fox

        Do not follow where the path may lead; go instead where there is no path.
        And leave a trail - Muriel Strode

        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by phildunlap

          True, it's applicable on any other Linux system - and you provided adequate notice that it's a bad place to make a mistake!

          1 Reply Last reply Reply Quote 0
          • S
            sky_watcher @phildunlap
            last edited by

            @phildunlap Hi Phil! Thanks for your advice.

            When I try to give that path to the backup directory I get an error:
            0_1567100665637_backup_error.jpg

            1 Reply Last reply Reply Quote 0
            • phildunlapP
              phildunlap
              last edited by

              Did you see over SSH or Webmin if the device is actually mounted there? It could also be a permissions issue, if Mango is running as a non-root user but that mounting point is owned by root. Check with ls -l /media/

              S 1 Reply Last reply Reply Quote 0
              • S
                sky_watcher @phildunlap
                last edited by

                @phildunlap On Mango I'm logged in with admin.

                The mounting point is owned by root.

                1 Reply Last reply Reply Quote 0
                • phildunlapP
                  phildunlap
                  last edited by phildunlap

                  Try chown'ing that to the 'mango' user like,

                  sudo chown -R mango:mango /media/usb*

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    sky_watcher @phildunlap
                    last edited by

                    @phildunlap I don't have permission to change the owner for /media/usb0/. Could be a problem because the USB is mounted there?

                    1 Reply Last reply Reply Quote 0
                    • phildunlapP
                      phildunlap
                      last edited by

                      I wouldn't think so. Did you sudo? What response did you get from running the command?

                      1 Reply Last reply Reply Quote 0
                      • phildunlapP
                        phildunlap
                        last edited by

                        I edited the command, as there was no reason to give the mango user access to /media/boot/

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

                          This is the command and the error:

                          0_1567102304395_owner_error.jpg

                          1 Reply Last reply Reply Quote 0
                          • phildunlapP
                            phildunlap
                            last edited by

                            It could be caused by the filesystem type not supporting Linux permissions. Perhaps you could reformat the drive to an ext3 or ext4 filesystem?

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              sky_watcher @phildunlap
                              last edited by

                              @phildunlap I get same error in mango and the drive is formatted as ext4, is mounted and the mango user has wrights to write on the usb0 folder.

                              0_1567105280887_format_type.jpg

                              1 Reply Last reply Reply Quote 0
                              • MattFoxM
                                MattFox
                                last edited by

                                Hi guys, just gonna give a suggestion, cd into /media/usb0/
                                then do the chown again

                                sudo chown mango:mango . -R
                                

                                then enter the

                                ls -la
                                

                                That should give us all info for that directory to start. Skywatcher, assuming you are using putty if you highlight the text, you can then paste into here with code tags.

                                You should be able to create a file just with touch file
                                no sudo required

                                Do not follow where the path may lead; go instead where there is no path.
                                And leave a trail - Muriel Strode

                                S 1 Reply Last reply Reply Quote 0
                                • phildunlapP
                                  phildunlap
                                  last edited by

                                  Also ensure the mango user has at least read permissions to /media

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    sky_watcher @MattFox
                                    last edited by phildunlap

                                    @mattfox said in Cron pattern to copy over a USB drive:

                                    total 24
                                    drwxr-xr-x  3 mango mango  4096 Aug 29 14:54 .
                                    drwxr-xr-x 12 root  root   4096 Aug 29 11:45 ..
                                    drwx------  2 mango mango 16384 Aug 29 14:54 lost+found
                                    root@mangoES3324:/media/usb0$touch file
                                    root@mangoES3324:/media/usb0$la -ls
                                    total 16
                                     0 -rw-r--r-- 1 root  root      0 Aug 29 15:22 file
                                    16 drwx------ 2 mango mango 16384 Aug 29 14:54 lost+found
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • MattFoxM
                                      MattFox
                                      last edited by MattFox

                                      You're logged in as root, you need to be the mango user if you want to test effectively, also please use those code tags, it makes a lot easier to read.

                                      Edit: Thanks!
                                      Ok dir permissions look good. Try doing the touch newfile as mango, if you can do that, there should be no issues with mango creating files. I'll check my server for you soon if wanted to compare configs.

                                      Fox

                                      Do not follow where the path may lead; go instead where there is no path.
                                      And leave a trail - Muriel Strode

                                      S 1 Reply Last reply Reply Quote 0
                                      • S
                                        sky_watcher @MattFox
                                        last edited by

                                        @mattfox

                                        mango@mangoES3324:/media/usb0$ls
                                        file  lost+found
                                        mango@mangoES3324:/media/usb0$touch newfile
                                        mango@mangoES3324:/media/usb0$ls
                                        file  lost+found  newfile
                                        mango@mangoES3324:/media/usb0$ls -la
                                        total 24
                                        drwxr-xr-x  3 mango mango  4096 Aug 29 15:43 .
                                        drwxr-xr-x 12 root  root   4096 Aug 29 11:45 ..
                                        -rw-r--r--  1 root  root      0 Aug 29 15:22 file
                                        drwx------  2 mango mango 16384 Aug 29 14:54 lost+found
                                        -rw-r--r--  1 mango mango     0 Aug 29 15:43 newfile
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • MattFoxM
                                          MattFox
                                          last edited by

                                          Perfect, try doing backups now with mango

                                          Do not follow where the path may lead; go instead where there is no path.
                                          And leave a trail - Muriel Strode

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

                                            ok, now worked, I can use that path and my back-up was saved there.

                                            Also I have a question, this feature of writing directly the location of the USB drive into the Backup Directory works only in V3? In V2.8 is it working or not?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post