Creating automatic backup in Solus10 Oct 2016
This morning I accidentally (well, I was not aware that I was not in the correct folder) all my project files today.
Lesson learned - recovery for (rm -rf *) is almost impossible.
The good thing is that I worked on the project over the weekend, so some stuff are still fresh in my mind. But first, I am going to create back up and automate it for every 2 hours because I am paranoid like that. I am going to leave the backup on my desktop.
In Solus, cron is not installed by default and they use systemd/Timers (https://wiki.archlinux.org/index.php/Systemd/Timers) instead for replacement.
Create a file named as backup-workspace.service in /etc/systemd/system
sudo touch backup-workspace.service
</pre>Add in the following using your favorite text editor:
# Service (/etc/systemd/system/backup-workspace.service)
Description=automatically backup workspace
ExecStart=tar -cvpzf /home/raf/Desktop/Workspace-backup.tar.gz /home/raf/Workspace
# Timer (/etc/systemd/system/backup-workspace.timer)
Description=Runs backup-workspace service every hour
# Time to wait after booting before we run first time
# Time between running each consecutive time
I created an alias/shortcut key to do the backup manually too by editing my ~/.bashrc file.
<pre>alias backup=”tar -cvpzf /home/raf/Desktop/Workspace-backup.tar.gz /home/raf/Workspace”</pre><pre></pre></pre>