Skip to content

systemd service ​

On Linux operating systems, you may want to run TBBM PROZESSING using systemd timers.

Installing PROZESSING ​

  1. Install Python 3.15
  2. Add a service user prozessing
  3. Create /var/prozessing and make it writable for the user prozessing
  4. Copy prozessing.pyz to /opt/PROZESSING/prozessing.pyz
  5. Install systemd service PROZESSING@.service (see below)

Creating and scheduling a job foobar ​

  1. Install the INI file foobar.ini to /opt/PROZESSING/ini/
  2. Create a PROZESSING@foobar.timer (see below) in /etc/systemd/system/
  3. Run systemctl enable --now PROZESSING@foobar.timer to start the timer
  4. Run systemctl status PROZESSING@foobar.timer to get the status of the timer
  5. Run systemctl start --no-block PROZESSING@foobar.service to run the job now
  6. Run systemctl status PROZESSING@foobar.service to get the status of the last run
  7. Run journalctl --pager-end --unit PROZESSING@foobar.service to see the logs

Managing services and timers ​

Helpful commands for the service and timers:

  • systemctl list-timers – list all timers

Systemd timers support a variety of timespans and calendar Events, see systemd.time for details.

ini
# /etc/systemd/system/PROZESSING@.service
[Unit]
Description=TBBM PROZESSING for %i
Documentation=https://prozessing.tbbm.at/

[Service]
Environment=LOGS_DIRECTORY=/var/prozessing/logs/
ExecStart=/usr/bin/python /opt/PROZESSING/prozessing.pyz ini/%i.ini
NoNewPrivileges=true
PrivateDevices=true
PrivateIPC=true
PrivateTmp=true
PrivateUsers=true
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict
ReadWritePaths=/var/prozessing/
Type=oneshot
User=prozessing
WorkingDirectory=/opt/PROZESSING/
ini
# /etc/systemd/system/PROZESSING@foobar.timer
[Unit]
Description=foobar
Documentation=https://wiki.example.com/jobs/foobar

[Install]
WantedBy=timers.target

# use one of the following [Timer] blocks

# run daily
[Timer]
OnCalendar=daily
Persistent=true
RandomizedDelaySec=10m

# run daily at 03:10:00
[Timer]
OnCalendar=*-*-* 03:10:00
Persistent=true
RandomizedDelaySec=30s

# run hourly at hh:06:00
[Timer]
OnCalendar=*-*-* *:06:00
Persistent=true
RandomizedDelaySec=30s

# run every 5min
[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
RandomizedDelaySec=30s