Is it possible to give my systemd service more than one argument?
I'd like to execute a program with multiple arguments which have to be decided by the final user.
E.g: ./program arg1 arg2
To start it a single argument app I'd need something like systemctl start arg1@program
, where in the service definition I have ExecStart = /usr/bin/program ℅i
.
Thanks!
Best Answer
Yes you can! Define them in a file somewhere and add them to
EnvironmentFile
in your systemd Service. For example, say the contents of /etc/.progconf are:And your .service file:
You can write to that file if you need to change them on the go. A service shouldn't change its options very often, maybe consider autostarting or cron if you need to achieve that.
For more examples check: https://wiki.archlinux.org/index.php/Systemd/Services