You are not logged in.
I've setup systemd to send an email if a unit errors. I'm running into an issue with a backup with borg reporting an error due to a locked repository, but systemd isn't failing when the error occurs.
Here's journalctl output:
Feb 15 23:00:03 parnass systemd[1]: Starting borg backup...
Feb 15 23:00:12 parnass backup-borg[1854464]: mount: /home/backup: /dev/sdd2 already mounted on /home/backup.
Feb 15 23:00:14 parnass backup-borg[1854470]: Failed to create/acquire the lock /home/backup/borg/lock.exclusive (timeout).
Feb 15 23:00:14 parnass backup-borg[1854470]: terminating with error status, rc 2
Feb 15 23:00:16 parnass backup-borg[1854482]: Failed to create/acquire the lock /home/backup/borg/lock.exclusive (timeout).
Feb 15 23:00:16 parnass backup-borg[1854482]: terminating with error status, rc 2
Feb 15 23:00:18 parnass backup-borg[1854494]: umount: /home/backup: target is busy.
Feb 15 23:00:18 parnass systemd[1]: backup-borg.service: Deactivated successfully.
Feb 15 23:00:18 parnass systemd[1]: Finished borg backup.
Here's a sample output of when the email is triggered based on the error:
Feb 15 18:00:03 parnass systemd[1]: Starting borg backup...
Feb 15 18:02:28 parnass backup-borg[1759902]: ssh: connect to host xxx.us.to port 2222: Connection timed out
Feb 15 18:04:43 parnass backup-borg[1760602]: Remote: ssh: connect to host xxx.us.to port 2222: Connection timed out
Feb 15 18:04:43 parnass backup-borg[1760602]: Connection closed by remote host. Is borg working on the server?
Feb 15 18:04:43 parnass backup-borg[1760602]: terminating with error status, rc 2
Feb 15 18:06:58 parnass backup-borg[1761305]: Remote: ssh: connect to host xxx.us.to port 2222: Connection timed out
Feb 15 18:06:58 parnass backup-borg[1761305]: Connection closed by remote host. Is borg working on the server?
Feb 15 18:06:58 parnass backup-borg[1761305]: terminating with error status, rc 2
Feb 15 18:09:13 parnass backup-borg[1761998]: ssh: connect to host xxx.us.to port 2222: Connection timed out
Feb 15 18:11:29 parnass backup-borg[1762685]: ssh: connect to host xxx.us.to port 2222: Connection timed out
Feb 15 18:11:29 parnass backup-borg[1762684]: rsync: connection unexpectedly closed (0 bytes received so far) [sender]
Feb 15 18:11:29 parnass backup-borg[1762684]: rsync error: unexplained error (code 255) at io.c(232) [sender=3.4.1]
Feb 15 18:11:29 parnass systemd[1]: backup-borg.service: Main process exited, code=exited, status=255/EXCEPTION
Feb 15 18:11:29 parnass systemd[1]: backup-borg.service: Failed with result 'exit-code'.
Feb 15 18:11:29 parnass systemd[1]: Failed to start borg backup.
Is there a way to make systemd report "Failed to start" for the first instance?
Last edited by watsonalgas (2025-02-17 00:10:13)
Offline
I think I figured it out. Since the command that was giving the error wasn't the last one in the script I was executing, then systemd was receiving the return code for a later command in that same script that exited successfully. I should've posted the script I was running in my original post.
Offline