systemd can be used for a user session and many scripts can be leveraged this way. Typically, it’s possible to replace CRON with systemd when setting timers. But the point here is to know a few commands that can be helpful when managing systemctl and journalctl to view how the unit services are behaving
In the examples below, I’m setting restic-backup.service but it can be any unit service file.
basic stop/start and enablers
systemctl --user start restic-backup.servicethis will execute the ExecStart part of the restic-backup service
systemctl --user stop restic-backup.servicesame thing but for halting.
To make sure it’s executed on user session start, you can enable the service :
systemctl --user enable restic-backup.service
systemctl --user disable restice-backup.service # to not have it no longer executed at startTo verify if a service that are currently enabled :
systemctl --user is-enabled restic-backup.servicelogs of a service
to view the logs of systemctl execution for a particular service
journalctl --user -u restic-backup.serviceto get a more detailed output and add colors you can add the -x (also known as --catalog) :
journalctl --user -xu restic-backup.service