Skip to content

Commit

Permalink
Add systemd unit and timer for synchroneous tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierba committed Nov 6, 2023
1 parent d027ca4 commit b0a96c3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/install/lib/systemd/system/lsc-oneshot.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=Run LSC jobs on demand
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
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
5 changes: 5 additions & 0 deletions src/install/lib/systemd/system/lsc-oneshot.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Unit]
Description=Periodically run LSC

[Timer]
OnCalendar= *:30:00
2 changes: 2 additions & 0 deletions src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
<directory>src/install/lib/systemd/system</directory>
<includes>
<include>lsc.service</include>
<include>lsc-oneshot.service</include>
<include>lsc-oneshot.timer</include>
</includes>
<outputDirectory>lib/systemd/system</outputDirectory>
<fileMode>0644</fileMode>
Expand Down

0 comments on commit b0a96c3

Please sign in to comment.