2

I have a systemd service with a paramter. It's working great. However, I cannot start it without a parameter.

The parameter would look like systemctl start my-service@1-0.service, where the 1-0 would be parsed by a php script. The php script has a default of 1-0, but I cannot start it with systemctl start my-service@.service. It tells me:

Failed to start my-service@.service: Unit name my-service@.service is missing the instance name.

I successfully enabled it with systemctl enable my-service@.service, but is it going to fail on boot? If so, how can I tell it to start with a default of 1-0 if nothing else is specified?

0

1 Answer 1

1

It appears that enabling a service with a default parameter is possible, per this guide. Since it needs to default to 1-0, I just did:

systemctl enable my-service\@1-0.service

It successfully created the symlink:

Created symlink /etc/systemd/system/multi-user.target.wants/my-service@1-0.service → /lib/systemd/system/my-service@.service

Thanks for the downvote btw. Stay classy.

"Fine... I'll do it myself." ~ Thanos

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.