I use MX Linux for professional systems that need regular backups. I'd like to create a Bash script that runs MX Snapshot automatically on a schedule and produces a live, bootable USB drive without requiring me to enter a sudo password each time. I'm not experienced with scripting, so I'm looking for guidance on whether this is possible and how to set it up safely.
2 Answers
Yes, this is possible, but the snapshot operation needs root privileges. The safer approach is usually to run the scheduled job as root rather than placing a broad password-free sudo rule in your account. If sudo must be used, create a narrowly scoped rule in a file under /etc/sudoers.d/ that permits only the specific snapshot command with NOPASSWD. Test the command manually first, then account for cron’s limited environment and use absolute paths in the script.
A cron job can launch a Bash script at the desired interval, but creating a bootable USB involves more than just copying files and may require a target device that is always connected and identified reliably. Make sure the script checks the correct destination before writing, since using the wrong device path could erase another disk. You’ll also need to decide how to handle logs, failures, and whether the USB should be unmounted safely when the job finishes.
I’d appreciate a tutorial or library reference for scripting this, especially since I don’t have enough coding experience to start from scratch.

Thanks for explaining. I’m not a techie and can’t write the script myself, so I was hoping for an example or a reference showing how to build it.