• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

duetbackup - CLI tool to backup your Duet SD Card [deprecated]

Scheduled Pinned Locked Moved
General Discussion
11
61
5.8k
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.
  • undefined
    mudcruzr @mudcruzr
    last edited by 4 Jun 2019, 16:34

    @mudcruzr said in duetbackup - CLI tool to backup your Duet SD Card:

    @wilriker said in duetbackup - CLI tool to backup your Duet SD Card:

    Release 1.1.0

    I just released v1.1.0 and I think this will make @mudcruzr quite happy - as well as I hope that other users will also be happy with the new feature. Release notes below.

    LOL

    Happy? Happy? I'm absolutely ecstatic mate! Seriously, many thanks for a very useful tool.

    Ah! not so happy now 😞 even with the exclude flag it's still including all the gcode files.

    Command line:

    ./duetbackup -domain "192.168.0.52" -outDir "Feynman" -dirToBackup "0:/" -exclude "0:/gcodes"

    (Sorry!)

    undefined 1 Reply Last reply 4 Jun 2019, 16:44 Reply Quote 0
    • undefined
      gtj0 @mudcruzr
      last edited by 4 Jun 2019, 16:44

      @mudcruzr said in duetbackup - CLI tool to backup your Duet SD Card:

      @mudcruzr said in duetbackup - CLI tool to backup your Duet SD Card:

      @wilriker said in duetbackup - CLI tool to backup your Duet SD Card:

      Release 1.1.0

      I just released v1.1.0 and I think this will make @mudcruzr quite happy - as well as I hope that other users will also be happy with the new feature. Release notes below.

      LOL

      Happy? Happy? I'm absolutely ecstatic mate! Seriously, many thanks for a very useful tool.

      Ah! not so happy now 😞 even with the exclude flag it's still including all the gcode files.

      Command line:

      ./duetbackup -domain "192.168.0.52" -outDir "Feynman" -dirToBackup "0:/" -exclude "0:/gcodes"

      (Sorry!)

      confirmed....

      $ ./duetbackup -domain duet0 -outDir "backup" -dirToBackup "0:/" -exclude "0:/gcodes"
      2019/06/04 10:42:56 Fetching filelist for 0:/
      2019/06/04 10:42:57 Downloading new/changed files from 0:/ to /usr/src/3d/duet0/backup
      2019/06/04 10:42:57 Fetching filelist for 0://Probe
      2019/06/04 10:42:57 Downloading new/changed files from 0://Probe to /usr/src/3d/duet0/backup/Probe
      2019/06/04 10:42:57 Fetching filelist for 0://System Volume Information
      2019/06/04 10:42:57 Downloading new/changed files from 0://System Volume Information to /usr/src/3d/duet0/backup/System Volume Information
      2019/06/04 10:42:57 Fetching filelist for 0://filaments
      2019/06/04 10:42:57 Downloading new/changed files from 0://filaments to /usr/src/3d/duet0/backup/filaments
      2019/06/04 10:42:57 Fetching filelist for 0://filaments/PLA
      2019/06/04 10:42:57 Downloading new/changed files from 0://filaments/PLA to /usr/src/3d/duet0/backup/filaments/PLA
      2019/06/04 10:42:57 Fetching filelist for 0://gcodes
      2019/06/04 10:42:57 Downloading new/changed files from 0://gcodes to /usr/src/3d/duet0/backup/gcodes

      Note the double //. If you specify -exclude "0://gcodes" it works.

      undefined 1 Reply Last reply 4 Jun 2019, 20:25 Reply Quote 2
      • undefined
        wilriker @gtj0
        last edited by wilriker 6 Apr 2019, 20:38 4 Jun 2019, 20:25

        @gtj0 @mudcruzr I can see where the bug is. Will fix it tomorrow.

        P.S.: Another workaround in addition to what @gtj0 already said would be to specify -dirToBackup 0: without the trailing slash.

        Manuel
        Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
        with probably always latest firmware/DWC (incl. betas or self-compiled)
        My Tool Collection

        1 Reply Last reply Reply Quote 0
        • undefined
          wilriker
          last edited by 5 Jun 2019, 09:17

          Release 1.1.2

          Here we go with v1.1.2.

          This release fixes the issue where trailing (and/or possibly multiple successive) slashes can break the exclude feature.

          Also in this release:

          • Excluding is now more efficient by checking if a directory can be excluded as a whole instead of only excluding everything inside it
          • Approximate download speeds have been added to the output
          • Remove local directories recursively if they no longer exist remote and -removeLocal has been given

          Manuel
          Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
          with probably always latest firmware/DWC (incl. betas or self-compiled)
          My Tool Collection

          undefined 1 Reply Last reply 5 Jun 2019, 09:26 Reply Quote 1
          • undefined
            mloidl @wilriker
            last edited by 5 Jun 2019, 09:26

            @wilriker
            Hi,
            Many thanks for the update, i've not tried it yet, but as i saw in the code you're now using os.RemoveAll instead of os.Remove.
            This would mean that non-empty directories will be deleted too. Including e.g. .git or similar folders.

            I already thought about an additional option to black list some folders/files from cleanup, but had no idea where to put that.
            In my local branch (not pushed) i've created a hard-coded list but this might not be very useful for others.
            Another option would be to store the filenames in a kind of config file or (.blacklist, whatever) which can be changed by users without modifying the code.

            Do you have some suggestions? If you wan't i can then try to implement it.

            undefined 1 Reply Last reply 5 Jun 2019, 09:30 Reply Quote 0
            • undefined
              wilriker @mloidl
              last edited by 5 Jun 2019, 09:30

              @mloidl You are right I did not think of VCS. 🤦 I'll think about a better solution.

              Manuel
              Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
              with probably always latest firmware/DWC (incl. betas or self-compiled)
              My Tool Collection

              1 Reply Last reply Reply Quote 0
              • undefined
                wilriker
                last edited by 5 Jun 2019, 10:06

                Release 1.2.0

                And another one named v1.2.0 has been released to address the issue brought up by @mloidl.

                To prevent removing directories not managed by duetbackup the tool will now create files named .duetbackup in each directory it creates.

                If for example the user will then initialize a git repository inside the local backup directory the .git directory will be skipped when removing files that do not exist remote.

                Manuel
                Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                with probably always latest firmware/DWC (incl. betas or self-compiled)
                My Tool Collection

                undefined 1 Reply Last reply 5 Jun 2019, 10:12 Reply Quote 1
                • undefined
                  wilriker
                  last edited by 5 Jun 2019, 10:09

                  7 Releases in 5 days - you guys are awesome in spotting issues! I really appreciate the feedback from all of you. 🙂 👍

                  Manuel
                  Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                  with probably always latest firmware/DWC (incl. betas or self-compiled)
                  My Tool Collection

                  1 Reply Last reply Reply Quote 0
                  • undefined
                    mloidl @wilriker
                    last edited by 5 Jun 2019, 10:12

                    That was really fast. 👍
                    Will test it when i'm at home on the machine.

                    undefined 1 Reply Last reply 5 Jun 2019, 10:17 Reply Quote 0
                    • undefined
                      wilriker @mloidl
                      last edited by 5 Jun 2019, 10:17

                      @mloidl Thanks. I borrowed the idea from tools like Dropbox or Syncthing that also use marker files (for different purposes but that doesn't matter) so it was only implementation and local testing effort.

                      Fun fact: while implementing everything worked immediately protecting unmanaged directories but strangely there was not a single marker file inside the directories after the tool had finished. It took me quite a while to figure out that I forgot to also exclude the marker file itself from being removed. 😂 It would even have worked this way since I create the file everytime I visit a managed directory but that would have been too much voodoo-magic-implementation to keep. 😁

                      Manuel
                      Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                      with probably always latest firmware/DWC (incl. betas or self-compiled)
                      My Tool Collection

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        dc42 administrators @wilriker
                        last edited by 5 Jun 2019, 16:31

                        @wilriker said in duetbackup - CLI tool to backup your Duet SD Card:

                        @dc42 Still if the file is there Content-Encoding: gzip is wrong.

                        This should be fixed in 2.03RC5 which I have just released.

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        1 Reply Last reply Reply Quote 1
                        • undefined
                          Phaedrux Moderator
                          last edited by Phaedrux 6 May 2019, 18:14 5 Jun 2019, 17:29

                          Just tested 1.2.0 on Mac using a command file to automate the process and it works great.

                          For those interested in making a shortcut file to run instead of using the command line each time. It will create a time stamped directory to download the backup to. You can create separate shortcut files to run different backups, different printers, etc.

                          This is Mac specific, but similar could be achieved on other OS as well.

                          Save the following into a text file and save it with .command extension. You will need to modify the following script to suit your setup

                          #!/bin/bash
                          _timestamp=$(date +"%Y-%m-%d-%H%M")
                          _filename="Backup-$_timestamp"
                          cd "/PATH/TO/DUETBACKUP/duetbackup-darwin_amd64"
                          ./duetbackup -domain duet.local -outDir "$_filename" -dirToBackup "0:/" -exclude "0:/gcodes"

                          You may need to make the resulting .command file executable for it to work from the Finder. In Terminal, navigate to the directory the .command file is in, and use chmod +x FILENAME.command to make it executable so you can double click on it from the Finder to run it. Change FILENAME to be whatever the filename you saved it as.

                          Thanks @wilriker for the awesome backup tool!

                          Z-Bot CoreXY Build | Thingiverse Profile

                          1 Reply Last reply Reply Quote 0
                          • undefined
                            mloidl
                            last edited by 5 Jun 2019, 17:54

                            Also tested v1.2.0 on linux. Works like a charm.

                            Thanks @wilriker for this awesome tool.

                            1 Reply Last reply Reply Quote 0
                            • undefined
                              Exerqtor
                              last edited by 7 Jun 2019, 09:00

                              Uhm, might be that I'm dumber than the average in here, but i can't understand how to use this at all lol.
                              I'm on a Win10 system, and when i click the .exe it just open a commandline for 0.4sec and it disapears (same happens if i run it as admin).

                              undefined 1 Reply Last reply 7 Jun 2019, 09:05 Reply Quote 0
                              • undefined
                                wilriker @Exerqtor
                                last edited by 7 Jun 2019, 09:05

                                @exerqtor It's a command line tool. Clicking on it will - as you described - open the command window, show the error about missing parameters and immediately close it again.

                                You need to open the command line manually (open the start menu type cmd and hit enter). Then navigate to the directory the duetbackup.exe sits in and use the parameters as described in the first post or run

                                duetbackup --help
                                

                                to get the list of available parameter with a short explanation on what their meaning is.

                                Manuel
                                Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                with probably always latest firmware/DWC (incl. betas or self-compiled)
                                My Tool Collection

                                1 Reply Last reply Reply Quote 0
                                • undefined
                                  Exerqtor
                                  last edited by Exerqtor 6 Jul 2019, 09:21 7 Jun 2019, 09:21

                                  Ah, thx for the quick answer.
                                  Not gonna spend time learing to use CLI in 2019, sure a nice tool for those who allready know how to use it though.

                                  1 Reply Last reply Reply Quote 0
                                  • undefined
                                    OBELIKS
                                    last edited by 7 Jun 2019, 12:11

                                    If I am not too lazy I might prepare something for those that want GUI

                                    0_1559909376149_7871a8af-99d1-4602-9ffc-b8306f55d36b-image.png

                                    At first I think I will leave excludes alone. For that I am definitely too lazy.

                                    If Manuel agrees naturally.

                                    P3Steel Toolson mk2 - Duet 2 WiFi --> RatRig V-Core with Duet WiFi 1.03
                                    Original Prusa i3 MK3S

                                    undefined undefined 2 Replies Last reply 7 Jun 2019, 12:13 Reply Quote 1
                                    • undefined
                                      Exerqtor @OBELIKS
                                      last edited by 7 Jun 2019, 12:13

                                      @obeliks
                                      That would be sweet for us simple/lazy people! 😂

                                      1 Reply Last reply Reply Quote 0
                                      • ?
                                        A Former User
                                        last edited by 7 Jun 2019, 12:24

                                        imo "lazy" people should look into scheduled task on windows or cron on linux, no need for GUI and no need to remember to make the backup

                                        1 Reply Last reply Reply Quote 0
                                        • undefined
                                          wilriker @OBELIKS
                                          last edited by 7 Jun 2019, 12:44

                                          @obeliks It's open source so knock yourself out. 😂

                                          But you might want to wait until next week. I have a huge update and extension coming. @gtj0 will probably be very happy then. 🙂

                                          Manuel
                                          Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                          with probably always latest firmware/DWC (incl. betas or self-compiled)
                                          My Tool Collection

                                          undefined 1 Reply Last reply 7 Jun 2019, 13:57 Reply Quote 3
                                          36 out of 61
                                          • First post
                                            36/61
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA