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.

Description=PhantomJS Webdriver

ExecStart=phantomjs --webdriver=4444


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

1 Answer 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .