Skip to content

Commit

Permalink
add an example of instance of LSC systemd task (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coutadeur committed Jan 8, 2024
1 parent 310c94a commit 527a318
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/install/etc/default/lsc-exampleasynctask
Original file line number Diff line number Diff line change
@@ -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=""
25 changes: 25 additions & 0 deletions src/install/etc/default/lsc-examplesynctask
Original file line number Diff line number Diff line change
@@ -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=""
23 changes: 23 additions & 0 deletions src/install/lib/systemd/system/[email protected]
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions src/install/lib/systemd/system/[email protected]
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@
<directory>src/install/lib/systemd/system</directory>
<includes>
<include>lsc.service</include>
<include>[email protected]</include>
<include>lsc-oneshot.service</include>
<include>[email protected]</include>
<include>lsc-oneshot.timer</include>
</includes>
<outputDirectory>lib/systemd/system</outputDirectory>
Expand All @@ -161,7 +163,11 @@
<!-- System conf files -->
<fileSet>
<directory>src/install/etc/default</directory>
<includes> <include>lsc</include> </includes>
<includes>
<include>lsc</include>
<include>lsc-examplesynctask</include>
<include>lsc-exampleasynctask</include>
</includes>
<outputDirectory>etc/default</outputDirectory>
<fileMode>0644</fileMode>
<directoryMode>0755</directoryMode>
Expand Down

0 comments on commit 527a318

Please sign in to comment.