Reputation: 2716
I have a service named MyService
that needs to auto-start a NodeJS process only if "Configured!" can be found inside of a configuration file. The MyService.service
file contains the following in the Service
section:
ExecStart=/usr/bin/sh -c "if grep -q 'Configured!' /path/to/configuration/file.conf; then /usr/bin/node /path/to/node/process.js; fi"
However, the problem is that the NodeJS process does not auto-start. In fact, when I look in journalctl
, I see the following error message:
Path in condition not absolute, ignoring: "/path/to/configuration/file.conf"
How can I please change ExecStart
to successfully auto-start the NodeJS process when the condition has been met? This is very puzzling because when I run the ExecStart
command on the command line, it works correctly. Also, the path to the configuration file is an absolute path.
(Also, please note that since this machine is running an old version of systemd, I am not able to use ExecCondition
.)
Upvotes: 0
Views: 259
Reputation: 26697
The issue is with double quotes in :
"/path/to/configuration/file.conf"
which makes systemd think it's not a absolute path.
Upvotes: 1