From 5ac4abb62fe753161079358f775dd322e6791945 Mon Sep 17 00:00:00 2001 From: Vishal Bhavsar Date: Thu, 10 Jan 2019 17:27:41 -0500 Subject: [PATCH] Add a unit file to manage helios-agent service (#1265) * Add a unit file to manage helios-agent service This sets up helios-agent to be configured as a daemon and managed via systemd Change unit file install path Add comment to wrapper script Add `After` directive to unit file * Add unit file for helios-master --- helios-services/pom.xml | 36 +++++++++++++++++++++ src/deb/helios-agent/helios-agent-wrapper | 12 +++++++ src/deb/helios-agent/helios-agent.service | 10 ++++++ src/deb/helios-master/helios-master-wrapper | 12 +++++++ src/deb/helios-master/helios-master.service | 10 ++++++ 5 files changed, 80 insertions(+) create mode 100644 src/deb/helios-agent/helios-agent-wrapper create mode 100644 src/deb/helios-agent/helios-agent.service create mode 100644 src/deb/helios-master/helios-master-wrapper create mode 100644 src/deb/helios-master/helios-master.service diff --git a/helios-services/pom.xml b/helios-services/pom.xml index c2633cfa8..91e01a8cb 100644 --- a/helios-services/pom.xml +++ b/helios-services/pom.xml @@ -503,6 +503,24 @@ 755 + + ${project.parent.basedir}/src/deb/helios-master/helios-master.service + file + /etc/systemd/system/helios-master.service + + perm + 755 + + + + ${project.parent.basedir}/src/deb/helios-master/helios-master-wrapper + file + /usr/bin/helios-master-wrapper + + perm + 755 + + @@ -552,6 +570,24 @@ 755 + + ${project.parent.basedir}/src/deb/helios-agent/helios-agent.service + file + /etc/systemd/system/helios-agent.service + + perm + 755 + + + + ${project.parent.basedir}/src/deb/helios-agent/helios-agent-wrapper + file + /usr/bin/helios-agent-wrapper + + perm + 755 + + diff --git a/src/deb/helios-agent/helios-agent-wrapper b/src/deb/helios-agent/helios-agent-wrapper new file mode 100644 index 000000000..a6afa74db --- /dev/null +++ b/src/deb/helios-agent/helios-agent-wrapper @@ -0,0 +1,12 @@ +#!/bin/bash + +# This wrapper script allows initialization of +# environment variables since systemd's Environment and +# EnvironmentFile directives don't support running +# arbitrary commands. + +DEFAULTFILE=/etc/default/helios-agent + +[ -f $DEFAULTFILE ] && . $DEFAULTFILE + +exec /usr/bin/helios-agent ${HELIOS_AGENT_OPTS} diff --git a/src/deb/helios-agent/helios-agent.service b/src/deb/helios-agent/helios-agent.service new file mode 100644 index 000000000..c5794d3f5 --- /dev/null +++ b/src/deb/helios-agent/helios-agent.service @@ -0,0 +1,10 @@ +[Unit] +Description=Helios agent daemon +After=network.target + +[Service] +Type=simple +Restart=always +ExecStart=/usr/bin/helios-agent-wrapper +User=helios + diff --git a/src/deb/helios-master/helios-master-wrapper b/src/deb/helios-master/helios-master-wrapper new file mode 100644 index 000000000..63b07f58d --- /dev/null +++ b/src/deb/helios-master/helios-master-wrapper @@ -0,0 +1,12 @@ +#!/bin/bash + +# This wrapper script allows initialization of +# environment variables since systemd's Environment and +# EnvironmentFile directives don't support running +# arbitrary commands. + +DEFAULTFILE=/etc/default/helios-master + +[ -f $DEFAULTFILE ] && . $DEFAULTFILE + +exec /usr/bin/helios-master ${HELIOS_MASTER_OPTS} diff --git a/src/deb/helios-master/helios-master.service b/src/deb/helios-master/helios-master.service new file mode 100644 index 000000000..0a5b31d00 --- /dev/null +++ b/src/deb/helios-master/helios-master.service @@ -0,0 +1,10 @@ +[Unit] +Description=Helios master daemon +After=network.target + +[Service] +Type=simple +Restart=always +ExecStart=/usr/bin/helios-master-wrapper +User=helios +