duetbackup - CLI tool to backup your Duet SD Card [deprecated]
-
@dougal1957 @Phaedrux yes, the Darwin binary is supposed to work on MacOS 10.10 and later.
I don't know what you tried but for clarification: this is not an installer of any kind. It's the final binary and it's a pure command line tool with no GUI.
So after download open a shell and navigate to the directory the file sits in. Use
chmod +x duetbackup-darwin_amd64
to make it executable and then issue
./duetbackup-darwin_amd64
You should now get an error about missing parameters - but that also means it works.
P.S.: I'm on my phone and the filename was from memory so it might be a tiny bit different, please check that.
-
@wilriker that makes more sense. I'll try again tomorrow.
-
@phaedrux let me know if it works this way.
Also I will adjust packaging in the coming days so that a) the filename is the same fur every platform and b) it is already executable for Linux and MacOS. Right now on Windows you would also have to add
.exe
to the filename to achieve that - I should not do software releases when in a hurry. -
Under windows 10 I run:
.\duetbackup.exe -domain "192.168.0.53" -outDir ".\bkup"
(Tried it with & without the quotes and using ./bkup and .\bkup all with same error.)
and it errors with the following:
2019/06/01 20:15:32 Fetching filelist for 0:/sys
panic: time: missing Location in call to Time.InThe whole error message is here 0_1559416600853_Duetbackup_errors.txt
-
@mudcruzr Thanks for reporting. I'll have a look into that on Monday. This part of the code is rather sketchy and even marked with a
// FIXME
comment already. So I guess it's time to follow my own advices. -
-
OK still not sure about this on the mac
I tried the following with the latest 1.02 executable and get the following
I suspect I need to pass some arguments to it but not sure how? any help appreciated
Doug
-
@dougal1957 Yes, there are mandatory parameters. The names are given in the error message.
To find out all available parameters type
./duetbackup --help
The minimum valid command would look like
./duetbackup -domain "<your_duets_network_address>" -outDir <local_directory_to_save_files>
This will then sync all files in the SD card's
/sys
(default if-dirToBackup
is not provided) directory to the specified directory on your hard drive.P.S.: For applications implemented in Go it does not matter if you prefix parameters with one or two dashes, i.e.
-domain
and--domain
are treated identically. -
@wilriker said in duetbackup - CLI tool to backup your Duet SD Card:
Release 1.0.2
I just released version v1.0.2.
- This release should fix the time zone issue @mudcruzr described.
- Also starting from this release the (callable) filename for all target platforms now is
duetbackup
- for this the files are package as either tar.gz or zip depending on target
Works for me, many thanks! (Windows 10)
I have a suggestion (only semi-seriously), if it's not too cheeky: an exclude switch, e.g.
./duetbackup -dirToBackup "0:/" -excludeDir "0:/gcodes" -domain "192.168.0.53" -outDir "./bkup"
(I didn't realise how many files I had accumulated in my gcodes directory, lol)
-
@mudcruzr said in duetbackup - CLI tool to backup your Duet SD Card:
I have a suggestion (only semi-seriously), if it's not too cheeky: an exclude switch, e.g.
./duetbackup -dirToBackup "0:/" -excludeDir "0:/gcodes" -domain "192.168.0.53" -outDir "./bkup"
(I didn't realise how many files I had accumulated in my gcodes directory, lol)
I already have thought of that. I will see if I incorporate that - but on the other hand on successive calls it will only download new or changed files. GCodes files change rather seldomly so most of them won't get downloaded again.
-
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.
Exclude Feature
A new flag
-exclude
has been introduced to exclude remote paths starting with the given value. This flag can be used multiple times.Simple Example
./duetbackup -domain duet.localdomain -outDir "sys" -exclude "0:/sys/c"
will skip all files and folders in
/sys
that start with "c" likeconfig.g
orcancel.g
.Multi Example
./duetbackup -domain duet.localdomain -outDir "sys" -exclude "0:/sys/c" -exclude "0:/sys/home
will skip all files and folders in
/sys
that start with "c" likeconfig.g
orcancel.g
as well as all files starting with "home" likehomex.g
,homey.g
,homez.g
andhomeall.g
.Example Full Backup excluding GCode Files
./duetbackup -domain duet.localdomain -outDir "backup" -dirToBackup "0:/" -exclude "0:/gcodes"
Other Changes
- Some internal code simplifications
- Logging has been reformatted and reduced - the former amount of logging can be restored with the new flag
-verbose
-
Release 1.1.1
I had to release v.1.1.1 to fix a bug where the local directory has to exist unless the corresponding remote directory has a sub-directory.
Now all missing local directories are being created independently of the contents of the remote directory.
Also the order of file handling has been adjusted to first handle all files in the remote directory before traversing into sub-directories. This way the order of log statements makes much more sense.
-
@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.
-
Finally got it working (Due to me not knowing what I am doing with Mac command line I might add) but does it normally take for ever to complete i normally achieve 600kib/s or more on uploads?
-
@dougal1957 said in duetbackup - CLI tool to backup your Duet SD Card:
Finally got it working (Due to me not knowing what I am doing with Mac command line I might add) but does it normally take for ever to complete i normally achieve 600kib/s or more on uploads?
I went and cleaned out my Gcode directory first so that it didn't have to download all of them again.
-
@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!)
-
@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. -
-
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
-
@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.