Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kylemanna/systemd-utils
Random systemd utilities
https://github.com/kylemanna/systemd-utils
Last synced: 1 day ago
JSON representation
Random systemd utilities
- Host: GitHub
- URL: https://github.com/kylemanna/systemd-utils
- Owner: kylemanna
- License: mit
- Created: 2014-09-15T04:15:21.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-01-16T20:45:48.000Z (almost 3 years ago)
- Last Synced: 2024-11-04T21:37:28.665Z (7 days ago)
- Language: Python
- Size: 35.2 KB
- Stars: 88
- Watchers: 8
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# systemd-utils
Random systemd utilities and unit files.
## Usage
Recommended location:
cd $HOME/.config/systemd
git clone https://github.com/kylemanna/systemd-utils.git utilsSymlink or hardlink unit files into `$HOME/.config/systemd/user`. Systemd appears to have some issues with symlinked unit files at the time of writing.
## Scripts
### On Failure
* Allows users to specify `OnFailure=failure-email@%i.service` under `[Unit]` section of systemd files.
* The `failure-email` service will email the user when a service fails unexpectedly and include the `systemd status ` output.
* Example configuration systemd file:[Unit]
...
OnFailure=failure-email@%i.service### Failure Monitor
* Systemd service that runs and parses the output of journalctl. When a task fails, an email is sent to the user at the configured email address.
* The `failure-monitor` service will email the user when a service fails unexpectedly and include the `systemd status ` output.
* Example configuration:$ systemctl --user start failure-monitor@[email protected]
### Email Journal Log
Upon completion of a script (i.e. a daily backup script), send an email of the log output. The following code should be used to save a cursor before the execution of the service and send all the data followign that cursor.
ExecStartPre=/bin/sh -c 'journalctl -o cat -n 0 -u %n --show-cursor | cut -f3 -d" " > /run/%n.cursor'
ExecStart=...
ExecStopPost=/bin/sh -c '/etc/systemd/scripts/systemd-email [email protected] %n $(cat /run/%n.cursor)'
ExecStopPost=/bin/rm -f /run/%n.cursorIt would be nice if systemd provided a reference to a cursor prior to the most recent invocation of the service (like the --boot option refers to this boot). Until then hack around it.