add systemd unit file
Update the spec file with the rpm macro to put the unit file
in the system-wide unit file directory based on:
[root@1713bbf19a0b /]# rpmbuild --eval '%{_unitdir}'
/usr/lib/systemd/system
Allow user to create a drop directory to specify options
via environment variables.
Resolves https://github.com/purpleidea/mgmt/issues/12.
This commit is contained in:
22
README.md
22
README.md
@@ -25,6 +25,28 @@ If you have a well phrased question that might benefit others, consider asking i
|
|||||||
## Examples:
|
## Examples:
|
||||||
Please look in the [examples/](examples/) folder for more examples!
|
Please look in the [examples/](examples/) folder for more examples!
|
||||||
|
|
||||||
|
## Systemd:
|
||||||
|
See [`misc/mgmt.service`](misc/mgmt.service) for a sample systemd unit file.
|
||||||
|
This unit file is part of the RPM.
|
||||||
|
|
||||||
|
To specify your custom options for `mgmt` on a systemd distro:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo mkdir -p /etc/systemd/system/mgmt.service.d/
|
||||||
|
|
||||||
|
cat > /etc/systemd/system/mgmt.service.d/env.conf <<EOF
|
||||||
|
# Environment variables:
|
||||||
|
MGMT_SEED_ENDPOINT=http://127.0.0.1:2379
|
||||||
|
MGMT_CONVERGED_TIMEOUT=-1
|
||||||
|
MGMT_MAX_RUNTIME=0
|
||||||
|
|
||||||
|
# Other CLI options if necessary.
|
||||||
|
#OPTS="--max-runtime=0"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
```
|
||||||
|
|
||||||
## Documentation:
|
## Documentation:
|
||||||
Please see: [DOCUMENTATION.md](DOCUMENTATION.md) or [PDF](https://pdfdoc-purpleidea.rhcloud.com/pdf/https://github.com/purpleidea/mgmt/blob/master/DOCUMENTATION.md).
|
Please see: [DOCUMENTATION.md](DOCUMENTATION.md) or [PDF](https://pdfdoc-purpleidea.rhcloud.com/pdf/https://github.com/purpleidea/mgmt/blob/master/DOCUMENTATION.md).
|
||||||
|
|
||||||
|
|||||||
1
TODO.md
1
TODO.md
@@ -40,7 +40,6 @@ Let us know if you're working on one of the items.
|
|||||||
## Other
|
## Other
|
||||||
- [ ] implement noop functionality [bug](https://github.com/purpleidea/mgmt/issues/21) [:heart:](https://github.com/purpleidea/mgmt/labels/mgmtlove)
|
- [ ] implement noop functionality [bug](https://github.com/purpleidea/mgmt/issues/21) [:heart:](https://github.com/purpleidea/mgmt/labels/mgmtlove)
|
||||||
- [ ] better error/retry handling
|
- [ ] better error/retry handling
|
||||||
- [ ] mgmt systemd service file [bug](https://github.com/purpleidea/mgmt/issues/12) [:heart:](https://github.com/purpleidea/mgmt/labels/mgmtlove)
|
|
||||||
- [ ] deb package target in Makefile
|
- [ ] deb package target in Makefile
|
||||||
- [ ] reproducible builds
|
- [ ] reproducible builds
|
||||||
- [ ] add your suggestions!
|
- [ ] add your suggestions!
|
||||||
|
|||||||
13
misc/mgmt.service
Normal file
13
misc/mgmt.service
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Run mgmt configuration management
|
||||||
|
Documentation=https://github.com/purpleidea/mgmt/
|
||||||
|
After=systemd-networkd.service
|
||||||
|
Requires=systemd-networkd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/mgmt run ${OPTS}
|
||||||
|
RestartSec=5s
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
3
spec.in
3
spec.in
@@ -40,6 +40,8 @@ rm -rf %{buildroot}
|
|||||||
# _datadir is typically /usr/share/
|
# _datadir is typically /usr/share/
|
||||||
install -d -m 0755 %{buildroot}/%{_datadir}/__PROGRAM__/
|
install -d -m 0755 %{buildroot}/%{_datadir}/__PROGRAM__/
|
||||||
cp -a AUTHORS COPYING COPYRIGHT DOCUMENTATION.md README.md THANKS examples/ %{buildroot}/%{_datadir}/__PROGRAM__/
|
cp -a AUTHORS COPYING COPYRIGHT DOCUMENTATION.md README.md THANKS examples/ %{buildroot}/%{_datadir}/__PROGRAM__/
|
||||||
|
mkdir -p %{buildroot}/%{_unitdir}/
|
||||||
|
install -pm 0644 misc/__PROGRAM__.service %{buildroot}/%{_unitdir}/
|
||||||
|
|
||||||
# install the binary
|
# install the binary
|
||||||
mkdir -p %{buildroot}/%{_bindir}
|
mkdir -p %{buildroot}/%{_bindir}
|
||||||
@@ -58,6 +60,7 @@ install -m 0644 misc/example.conf %{buildroot}%{_sysconfdir}/__PROGRAM__/__PROGR
|
|||||||
%{_datadir}/__PROGRAM__/*
|
%{_datadir}/__PROGRAM__/*
|
||||||
%{_bindir}/__PROGRAM__
|
%{_bindir}/__PROGRAM__
|
||||||
%{_sysconfdir}/__PROGRAM__/*
|
%{_sysconfdir}/__PROGRAM__/*
|
||||||
|
%{_unitdir}/__PROGRAM__.service
|
||||||
|
|
||||||
# this changelog is auto-generated by git log
|
# this changelog is auto-generated by git log
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
Reference in New Issue
Block a user