0

I want to run PhantomJS in webdriver mode as a service on a CentOS box.

I created this systemd file but somehow the command-line argument is not accepted. The error message is Unit phantomjs-webdriver.service failed to load: Invalid argument.

[Unit]
Description=PhantomJS Webdriver
After=syslog.target

[Service]
User=xxxxx
ExecStart=phantomjs --webdriver=4444
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

Is it at all possible to use command-line switches in ExecStart?

Kees de Kooter
  • 187
  • 1
  • 1
  • 7

1 Answers1

1

Yes, command-line switches in ExecStart are allowed in unit files. For example:

$ grep ExecStart /usr/lib/systemd/system/sshd.service 
ExecStart=/usr/bin/sshd -D

Your unit is not valid because the first ExecStart= argument must be the a full path of an executable file (reference). You can find it with which phantomjs command.