Make systemd give a command to start an application

As far as I know systemd unit files do point to a script.sh (Am I correct?)
Is it possible to make a unit file for systemd with a command?
I would like to connect to a vpn with the command protonvpn c -X.
Like this:

[Service]
ExecStart=protonvpn c -X

Does systemd do that?

Yes it can.
I’m guessing you want to do something similiar to: https://www.x86txt.com/articles/protonvpn-cli-systemd.html

For Reference:



https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Depending on what you’re trying to do you can set up system or user services as well.

3 Likes

Well thanks for the answer.
Your solution is: point at a script or application and make that start.

My conclusion: in the unit one cannot use commands the same way one does in terminal. Always first point at an application.
Thanks again.