Skip to content

Instantly share code, notes, and snippets.

@hoto
Forked from nickjacob/systemd-prblm.service
Created June 27, 2017 14:38
Show Gist options
  • Save hoto/1b3fed11a912fd7d58f680d06489294f to your computer and use it in GitHub Desktop.
Save hoto/1b3fed11a912fd7d58f680d06489294f to your computer and use it in GitHub Desktop.
execute arbitrary bash code/variable substitution in systemd units
[Unit]
Description=Demonstrate Bash
[Service]
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))"
ExecStart=/usr/bin/ech "2 + 2 = ${MYVAR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment