Autoshift is a bash script that aims to provide similar functionality as timeshift-autosnap, written by Marko Gobin.
I say similar because:
-
This script does not add hooks to the package manager.
Which means you can run individual package manager tasks without having to use extra options to avoid the automation.
I opted to create this as a stand-alone script so that you can do manual updates, if required, without triggering another backup. -
This script will run itself once a week (starting from the date of first run), by default.
I find that 1 week is a happy medium. Let me know if this needs to be an adjustable option.
Since this script uses anacron instead of cron jobs, it will run, even if the scheduled time is missed.
For example: If your backup is set for every Monday, but your computer remains in sleep mode from Sunday to Thursday, the script will run itself when you wake your computer up on Friday. -
AutoSHIfT is made for use with RHEL/Fedora based systems that utilize the DNF package manager
System Requirements:
RHEL or Fedora based OS utilizing dnf as it's package manager.
Timeshift backup utility (The script will check Timeshift and install it, if not present)
Flatpak (you can, remove the flatpak commands if you don't use flatpaks)
Simply download the script from the Download Page
or clone the repository.
Make it executable: chmod +x AutoSHIfT.sh
Then run it with sudo: sudo ./AutoSHIfT.sh
- Create the cron job in the anacrontab file.
- Create a folder for itself and its logs in your logged-in user's home directory.**
- Move itself into the new folder.
- Check number of backups, if more than 10, it will delete 1 of the backups before creating a new backup.
- Perform all updates.
- Create a log.
- Display a notification when the processes is complete. The notification has to be clicked to be dismissed.
** The script will look for the logged in user automatically. If you have more than 1 user logged in on your machine, or you just want to specify a different user, then you may want to edit the script and manually enter the user that the script should be installed under. The variable is specifically noted towards the top of script.
*** The default settings for the number of backup copies to keep is 10. This can be adjusted in the script.
The variable is noted towards the top of script
Inspiration for this script comes from
https://gitlab.com/gobonja/timeshift-autosnap
and
https://github.com/wmutschl/timeshift-autosnap-apt