The idea is to use a variable pointing to node instead of hardcoded path, my solution was this ExecStart="$(which node)" /home/jonma/Development/chewy
But when I run the service I get the following error:
feb 08 11:12:51 jonma-VirtualBox systemd[1]: [/lib/systemd/system/chewy.service:2] Executable path is not absolute, ignoring: $(which node) /home/jon
feb 08 11:12:51 jonma-VirtualBox systemd[1]: chewy.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
How can I achieve this without hardcoding the path?
systemd
will not accept commands that are not given with absolute path, so to accomplish what you want you need rely on bash-ism and do one of the following:
ExecStart=/bin/bash -c '$$(which node) /home/jonma/Development/chewy'
or
ExecStart=/bin/bash -c '`which node` /home/jonma/Development/chewy'
(i like the first one better, but you can do any)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With