I have an Arch Linux system with systemd and I’ve created my own service. The configuration service at
/etc/systemd/system/myservice.service looks like this:
[Unit] Description=My Daemon [Service] ExecStart=/bin/myforegroundcmd [Install] WantedBy=multi-user.target
Now I want to have an environment variable set for the
/bin/myforegroundcmd. How do I do that?
The recommended way to do this is to create a file
/etc/sysconfig/myservice which contains your variables, and then load them with
For complete details, see Fedora’s documentation on how to write a systemd script.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.