At run time it is possible to instantiate a template with several cells, the @ character is used to identify the relationship between the template and the cell file, the instantiation unit can be from another cell file (using the requires or wants options), or the Systemctlstart command. The Instantiation Service unit can be named in the following way:
The code is as follows:
Template_name@instance_name.service
Several instances can point to all instances common to the same template file configuration options, for example, the wants option for a unit configuration file can be:
The code is as follows:
Wants=getty@ttya.service,getty@ttyb.service
First let Systemd search for a given service unit, if not found, Systemd ignores the section between @ and Dot, searches directly for Getty@.service service files, reads the configuration, and starts the service.
Wildcard fields, called cell specifiers, can be used in any unit profile. The unit specifier replaces some units at run time with arguments and explanations. The commonly used cell descriptors are described below:
%n the entire cell name, including the suffix of the type,%n is the same meaning, but ASCII is substituted for the forbidden character.
%p prefix name, when instantiated, the%p represents the part before the @ character.
%i instance name, @ character and unit type direct part. %i is the same meaning, but ASCII replaces the forbidden character.
%H host name, the hostname when the configuration file is loaded.
The%t runtime directory, the current run directory, is the/run directory for the root user, and for the unprivileged user is the directory specified by the Xdg_runtime_dir variable.
For example, Getty@.service contains the following structure:
The code is as follows:
[Unit]
Description=gettyon%i
...
[Service]
Execstart=-/sbin/agetty--noclear%i$term
...
When Getty@ttya.service and Getty@ttyb.service are instantiated, description= is interpreted as "Gettyonttya" and "Gettyonttyb".