-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from atolab/feat/systemd-service
Systemd service
- Loading branch information
Showing
5 changed files
with
166 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
# postinst script for zenoh flow runtime | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <postinst> `configure' <most-recently-configured-version> | ||
# * <old-postinst> `abort-upgrade' <new version> | ||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> | ||
# <new-version> | ||
# * <postinst> `abort-remove' | ||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | ||
# <failed-install-package> <version> `removing' | ||
# <conflicting-package> <version> | ||
# for details, see https://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
|
||
case "$1" in | ||
configure) | ||
id -u zenohflowd >/dev/null 2>&1 || sudo useradd -r -s /bin/false zenohflowd | ||
sudo chown zenohflowd:zenohflowd -R /var/zenoh-flow | ||
systemctl daemon-reload | ||
;; | ||
|
||
abort-upgrade|abort-remove|abort-deconfigure) | ||
;; | ||
|
||
*) | ||
echo "postinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# dh_installdeb will replace this with shell code automatically | ||
# generated by other debhelper scripts. | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
# postrm script for fog05 | ||
# see: dh_installdeb(1) | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <postrm> `remove' | ||
# * <postrm> `purge' | ||
# * <old-postrm> `upgrade' <new-version> | ||
# * <new-postrm> `failed-upgrade' <old-version> | ||
# * <new-postrm> `abort-install' | ||
# * <new-postrm> `abort-install' <old-version> | ||
# * <new-postrm> `abort-upgrade' <old-version> | ||
# * <disappearer's-postrm> `disappear' <overwriter> | ||
# <overwriter-version> | ||
# for details, see https://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
|
||
case "$1" in | ||
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) | ||
userdel zenohflowd | ||
rm -rf /var/zenoh-flow | ||
;; | ||
|
||
*) | ||
echo "postrm called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# dh_installdeb will replace this with shell code automatically | ||
# generated by other debhelper scripts. | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
%define __spec_install_post %{nil} | ||
%define __os_install_post %{_dbpath}/brp-compress | ||
%define debug_package %{nil} | ||
|
||
Name: zenoh-flow-daemon | ||
Summary: Zenoh-Flow: zenoh-based data-flow programming framework for computations that span from the cloud to the device. | ||
Version: @@VERSION@@ | ||
Release: @@RELEASE@@%{?dist} | ||
|
||
License: EPL-2.0 OR Apache-2.0 | ||
|
||
Group: System Environment/Daemons | ||
Group: Applications/System | ||
Source0: %{name}-%{version}.tar.gz | ||
URL: http://zenoh.io | ||
|
||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | ||
BuildRequires: systemd | ||
Requires(pre): /usr/sbin/useradd, /usr/sbin/groupadd, /usr/bin/getent, /usr/sbin/usermod, /usr/bin/id, /usr/bin/echo, /usr/bin/tee | ||
Requires(post): systemd, /usr/bin/chown | ||
Requires(preun): systemd | ||
Requires(postun): systemd, /usr/sbin/userdel | ||
%description | ||
%{summary} | ||
|
||
%prep | ||
%setup -q | ||
|
||
%pre | ||
/usr/bin/getent group zenohflowd || /usr/sbin/fos -r myservice | ||
/usr/bin/getent passwd zenohflowd || /usr/sbin/useradd -r -s /bin/false zenohflowd | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
mkdir -p %{buildroot} | ||
cp -a * %{buildroot} | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
|
||
%post | ||
%systemd_post zenoh-flow.service | ||
/usr/bin/chown zenohflowd:zenohflowd -R /var/zenoh-flow | ||
|
||
%preun | ||
%systemd_preun zenoh-flow.service | ||
/usr/sbin/userdel zenohflowd | ||
|
||
%postun | ||
%systemd_postun_with_restart zenoh-flow.service | ||
|
||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%config(noreplace) /etc/zenoh-flow/runtime.yaml | ||
/usr/bin/zenoh-flow-daemon | ||
/var/zenoh-flow/placeholder | ||
/lib/systemd/system/zenoh-flow.service | ||
%{_unitdir}/zenoh-flow.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description = Eclipse Zenoh Flow runtime | ||
|
||
[Service] | ||
Type=simple | ||
Environment=RUST_LOG="zenoh-flow=info" | ||
PIDFile=/var/zenoh-flow/runtime.pid | ||
ExecStart = /usr/bin/zenoh-flow-daemon -c /etc/zenoh-flow/runtime.yaml | ||
KillMode=mixed | ||
KillSignal=SIGINT | ||
RestartKillSignal=SIGINT | ||
Restart=on-failure | ||
User=zenohflowd | ||
StandardOutput=syslog | ||
StandardError=syslog | ||
SyslogIdentifier=zenoh-flow-runtime | ||
[Install] | ||
WantedBy=multi-user.target |