From 527a318c18e3f9b7169d8a2fe0a76233f983f195 Mon Sep 17 00:00:00 2001 From: David Coutadeur Date: Mon, 8 Jan 2024 19:02:36 +0100 Subject: [PATCH] add an example of instance of LSC systemd task (#50) --- src/install/etc/default/lsc-exampleasynctask | 25 +++++++++++++++++ src/install/etc/default/lsc-examplesynctask | 25 +++++++++++++++++ .../lib/systemd/system/lsc-oneshot@.service | 23 ++++++++++++++++ src/install/lib/systemd/system/lsc@.service | 27 +++++++++++++++++++ src/main/assembly/dist.xml | 8 +++++- 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 src/install/etc/default/lsc-exampleasynctask create mode 100644 src/install/etc/default/lsc-examplesynctask create mode 100644 src/install/lib/systemd/system/lsc-oneshot@.service create mode 100644 src/install/lib/systemd/system/lsc@.service diff --git a/src/install/etc/default/lsc-exampleasynctask b/src/install/etc/default/lsc-exampleasynctask new file mode 100644 index 00000000..4d5ade72 --- /dev/null +++ b/src/install/etc/default/lsc-exampleasynctask @@ -0,0 +1,25 @@ +#==================================================================== +# Configuration for LSC init script +# (http://www.lsc-project.org). +#==================================================================== + +# LSC installation +LSC_BIN="/usr/local/lsc/bin/lsc" +LSC_CFG_DIR="/usr/local/lsc/etc" +LSC_USER="" +LSC_GROUP="" +LSC_PID_FILE="/var/run/lsc.pid" +LSC_TASKS="all" +LSC_PARAMS="" + +# JMX +LSC_JMXPORT="1099" + +# JAVA +#JAVA_HOME=/usr/java/jdk/jre + +LSC_CONFIG_DIR="/etc/lsc" +LSC_SYNC_TASKS="" +LSC_ASYNC_TASKS="-a exampletask" +LSC_CLEAN_TASKS="" +LSC_EXTRA_ARGS="" diff --git a/src/install/etc/default/lsc-examplesynctask b/src/install/etc/default/lsc-examplesynctask new file mode 100644 index 00000000..21c4204f --- /dev/null +++ b/src/install/etc/default/lsc-examplesynctask @@ -0,0 +1,25 @@ +#==================================================================== +# Configuration for LSC init script +# (http://www.lsc-project.org). +#==================================================================== + +# LSC installation +LSC_BIN="/usr/local/lsc/bin/lsc" +LSC_CFG_DIR="/usr/local/lsc/etc" +LSC_USER="" +LSC_GROUP="" +LSC_PID_FILE="/var/run/lsc.pid" +LSC_TASKS="all" +LSC_PARAMS="" + +# JMX +LSC_JMXPORT="1099" + +# JAVA +#JAVA_HOME=/usr/java/jdk/jre + +LSC_CONFIG_DIR="/etc/lsc" +LSC_SYNC_TASKS="-s exampletask" +LSC_ASYNC_TASKS="" +LSC_CLEAN_TASKS="-c exampletask" +LSC_EXTRA_ARGS="" diff --git a/src/install/lib/systemd/system/lsc-oneshot@.service b/src/install/lib/systemd/system/lsc-oneshot@.service new file mode 100644 index 00000000..899232d6 --- /dev/null +++ b/src/install/lib/systemd/system/lsc-oneshot@.service @@ -0,0 +1,23 @@ +[Unit] +Description=Run LSC specific instance %I +After=network.target + +[Service] +Type=oneshot +User=lsc +Group=lsc +Environment="LSC_CONFIG_DIR=/etc/lsc" +Environment="LSC_SYNC_TASKS=-s all" +Environment="LSC_CLEAN_TASKS=-c all" +Environment="LSC_EXTRA_ARGS=" +EnvironmentFile=-/etc/default/lsc-%i +ExecStartPre=/usr/bin/lsc -v -f ${LSC_CONFIG_DIR} +ExecStart=/usr/bin/lsc -f ${LSC_CONFIG_DIR} ${LSC_SYNC_TASKS} ${LSC_CLEAN_TASKS} ${LSC_EXTRA_ARGS} + +PrivateTmp=true +PrivateDevices=true +ProtectSystem=strict +ProtectKernelTunables=yes +ProtectControlGroups=yes +ReadWritePaths=/var/log/lsc +UMask=0007 diff --git a/src/install/lib/systemd/system/lsc@.service b/src/install/lib/systemd/system/lsc@.service new file mode 100644 index 00000000..565cb3d8 --- /dev/null +++ b/src/install/lib/systemd/system/lsc@.service @@ -0,0 +1,27 @@ +[Unit] +Description=LSC server for specific instance %I +After=network.target + +[Service] +Type=forking +User=lsc +Group=lsc +PIDFile=/run/lsc.pid +Environment="LSC_CONFIG_DIR=/etc/lsc" +Environment="LSC_ASYNC_TASKS=-a all" +Environment="LSC_EXTRA_ARGS=" +Environment="LSC_JMXPORT=" +EnvironmentFile=-/etc/default/lsc-%i +ExecStartPre=/usr/bin/lsc -v -f ${LSC_CONFIG_DIR} +ExecStart=/usr/bin/lsc -f ${LSC_CONFIG_DIR} ${LSC_ASYNC_TASKS} ${LSC_EXTRA_ARGS} + +PrivateTmp=true +PrivateDevices=true +ProtectSystem=strict +ProtectKernelTunables=yes +ProtectControlGroups=yes +ReadWritePaths=/var/log/lsc +UMask=0007 + +[Install] +WantedBy=multi-user.target diff --git a/src/main/assembly/dist.xml b/src/main/assembly/dist.xml index 40697ce5..f503c6d3 100644 --- a/src/main/assembly/dist.xml +++ b/src/main/assembly/dist.xml @@ -150,7 +150,9 @@ src/install/lib/systemd/system lsc.service + lsc@.service lsc-oneshot.service + lsc-oneshot@.service lsc-oneshot.timer lib/systemd/system @@ -161,7 +163,11 @@ src/install/etc/default - lsc + + lsc + lsc-examplesynctask + lsc-exampleasynctask + etc/default 0644 0755