I noticed a few more config wiping issues for latte dock, and I thought I’d share what I did to create backups since I’m a noob at making systemd services, and I figure this is where folks will search for a solution to that issue as well. No amount of someone simply saying “make a backup” is going to help me given how busy I am, so I took some initiative on behalf of other users to do this and document my process.
- first lesson, don’t hard reboot, raise the elephant (Enable it first: Latte Dock and fish stoped loading on boot after crash - #4 by elloquin)
- second lesson, make a backup! (systemd is more reliable than crontab) (Desktop Reset after atx hard reboot signal - #9 by TNE)
I wrote a script to backup to my smb share that I mounted in /etc/fstab bounced back and forth between these two tutorials to run that script on a schedule:
https://www.math.cmu.edu/~gautam/sj/blog/20200216-rsync-backups.html
I have a directory where i keep my scripts in my home directory, you probably keep them somewhere different, be mindful of that as you read through.
~/scripts/backup-latte-configs.sh :
#!/bin/bash
DATE=`date '+%Y%m%d-%H%M%S'`
LATTECONFIGDIR="/home/meredith/.config/latte"
ARCHIVETARGET="/mnt/fruitsalad/meredith/backups/latte/backup-latte-$DATE.tar.gz"
tar -cvzpf $ARCHIVETARGET $LATTECONFIGDIR
~/.config/systemd/user/backup.service :
[Unit]
OnFailure=notify-email@%i.service
[Service]
Type=oneshot
ExecStart=/bin/bash /home/meredith/scripts/backup-latte-configs.sh
~/.config/systemd/user/notify-email@.service :
[Unit]
Description=Send email
[Service]
Type=oneshot
ExecStart=sh -c 'systemctl --user status %i | \
mailx -s "[SYSTEMD %i] Fail" meredith'
~/.config/systemd/user/backup.timer :
[Unit]
Description="Automatically run backups"
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
Then in konsole, test it and enable if it works:
systemctl --user start backup.service
systemctl --user enable backup.timer
if it doesn’t work, journalctl --user-unit=backup.service
.
I hope this saves some users time and effort! Thank you for your help with this issue.