OctoPrint is a web interface for 3D printers, letting you manage prints and monitor progress without a constant USB connection between the printer and your computer. It is a lovely piece of software and I happily support it on Patreon.
But, for reasons I don’t entirely understand and despite conversation to the contrary, uploading large files (1mb+) through the normal drag-and-drop interface routinely fails, crashing the Raspberry Pi it runs on and requiring a hard unplug-and-replug reboot.
One workaround is to manually upload the file with scp:
scp ~/path/to/your/file.gcode email@example.com:~/.octoprint/uploads
Because I have to do that so often and can’t memorize the incantation, I wrote a wrapper bash script to help. It additionally limits the bandwidth speed to avoid stalling, compresses to speed things up, and temporarily stops the OctoPrint server to free up the Pi’s memory.
Those configuration variables should be fine defaults for default setups; adjust to suit your needs. Then run like so:
sh upload_to_octoprint.sh ~/path/to/your/file.gcode
- OctoPrint sanitizes filenames when uploading via GUI but doesn’t for manual uploads. As such, files with spaces in their names won’t show up. A more resilient script would do its own sanitation or, better yet, loudly fail
- If any SSH connection fails, it should immediately quit instead of blindly continuing
Still, pretty handy.