Systemd custom service
by JJJCR from LinuxQuestions.org on (#521P3)
Hi guys, to list all services in systemd is to just type: systemctl and press enter.
For custom services it will have an customName@service.blah.blah
Like this article below from this link: https://wiki.archlinux.org/index.php/systemd
Quote:
My question is, how to stop or restart the custom service by calling the service name.
Example if the name is like this: javaservice@name.service
The command to restart would be like this:
systemctl restart javaservice
It will be like that? Or how do we find the exact name to call the custom service?
Thank you.


For custom services it will have an customName@service.blah.blah
Like this article below from this link: https://wiki.archlinux.org/index.php/systemd
Quote:
Note: Some unit names contain an @ sign (e.g. name@string.service): this means that they are instances of a template unit, whose actual file name does not contain the string part(e.g. name@.service). string is called the instance identifier, and is similar to an argument that is passed to the template unit when called with the systemctl command: in the unit file it will substitute the %i specifier. To be more accurate, before trying to instantiate the name@.suffix template unit, systemd will actually look for a unit with the exact name@string.suffix file name, although by convention such a "clash" happens rarely, i.e. most unit files containing an @ sign are meant to be templates. Also, if a template unit is called without an instance identifier, it will just fail, since the %i specifier cannot be substituted |
Example if the name is like this: javaservice@name.service
The command to restart would be like this:
systemctl restart javaservice
It will be like that? Or how do we find the exact name to call the custom service?
Thank you.