diff options
| author | Patrick Spek <p.spek@tyil.nl> | 2024-08-09 11:40:17 +0200 |
|---|---|---|
| committer | Patrick Spek <p.spek@tyil.nl> | 2024-08-09 11:40:17 +0200 |
| commit | 14875f61c46f73616468c05778d9f4e163d8cd09 (patch) | |
| tree | 06bc03bf8a31251401f069c49468bf2aca1dbf1c | |
| parent | ef315f6777620d44a16bc48b3e602ba1725cf095 (diff) | |
| download | bashtard-14875f61c46f73616468c05778d9f4e163d8cd09.tar.gz bashtard-14875f61c46f73616468c05778d9f4e163d8cd09.tar.bz2 | |
Add systemd service
| -rw-r--r-- | CHANGELOG.md | 6 | ||||
| -rw-r--r-- | Makefile | 9 | ||||
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | share/svc/systemd/bashtard.service | 10 | ||||
| -rw-r--r-- | share/svc/systemd/bashtard.timer | 10 |
5 files changed, 40 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1680fac..4003ffb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] +### Added + +- Bashtard now bundles an example `.service` and example `.timer` file for use + with Systemd. They can be installed separetely with the `make` target + `install-svc-systemd`. + ### Fixed - `config_subkeys` and `config_subkeys_for` should now leave off the `&` at the @@ -21,6 +21,13 @@ all: install: bin lib share +install-svc-systemd: + mkdir -pv -- "$(PREFIX)$(ETCDIR)/systemd/system" + cp -rv -- \ + share/svc/systemd/bashtard.service \ + share/svc/systemd/bashtard.timer \ + "$(PREFIX)$(ETCDIR)/systemd/system" + uninstall: rm -fv -- "$(PREFIX)$(DESTDIR)/bin/bashtard" rm -rfv -- "$(PREFIX)$(DESTDIR)/lib/bashtard" @@ -107,4 +114,4 @@ share: share/os.d \ "$(PREFIX)$(DESTDIR)/share/bashtard" -.PHONY: all install uninstall pkg-debian qa bin lib man share +.PHONY: all install install-svc-systemd uninstall pkg-debian qa bin lib man share @@ -56,6 +56,12 @@ command for each playbook that is used on the machine. If you want to do updates on a regular basis, you should configure your preferred cron system to do so. +#### Systemd + +Bashtard contains an example `.service` and accompanying `.timer`, found in the +`share/svc/systemd` directory. These can be installed separately with `make +install-svc-systemd`. + ### Playbooks These are the essential components for doing the actual work. Playbooks are diff --git a/share/svc/systemd/bashtard.service b/share/svc/systemd/bashtard.service new file mode 100644 index 0000000..b2794a0 --- /dev/null +++ b/share/svc/systemd/bashtard.service @@ -0,0 +1,10 @@ +[Unit] +Description = Run bashtard sync action +After = network-online.target + +[Service] +Type = oneshot +ExecStart = /bin/sh -c "/usr/bin/bashtard sync" + +[Install] +WantedBy = multi-user.target diff --git a/share/svc/systemd/bashtard.timer b/share/svc/systemd/bashtard.timer new file mode 100644 index 0000000..01335e6 --- /dev/null +++ b/share/svc/systemd/bashtard.timer @@ -0,0 +1,10 @@ +[Unit] +Description = Run Bashtard on schedule + +[Timer] +OnStartupSec = 120 +OnUnitInactiveSec = 1800 +RandomizedDelaySec = 300 + +[Install] +WantedBy = timers.target |
