Sample Header Ad - 728x90

How to specify dynamic "Environment" variables in a systemd unit file?

6 votes
1 answer
998 views
This $(ls -d...) does not work in a systemd unit file: [Service] Type=forking Environment="ORACLE_HOME=$(ls -d /usr/lib/oracle/*/client64 | sort -rV | head -n1)" Environment="TNS_ADMIN=$(ls -d /usr/lib/oracle/*/client64/lib/network/admin | sort -rV | head -n1)" I want to avoid hard-coding the Oracle client version (at the moment 19.19), to simplify updates. When I install a new Oracle client, I don't want to have to modify the systemd unit file. How can I achieve that? I use RHEL9 if that matters.
Asked by Sybil (1983 rep)
Mar 6, 2024, 08:28 AM
Last activity: Mar 6, 2024, 06:57 PM