if Type=simple
in your device’s file, you can specify only one ExecStart, but you can add as many ExecStartPre,
ExecStartPost`, but none of them is suitable for long commands, because they are executed sequentially and all one start starts before the next starts.
If Type=oneshot
you can specify multiple ExecStart, they are run sequentially not in parallel.
, :
1
, /etc/systemd/system/foo@.service
. : ( @
).
[Unit]
Description=script description %I
[Service]
Type=simple
ExecStart=/script.py %i
Restart=on-failure
[Install]
WantedBy=multi-user.target
:
$ systemctl start foo@parameter1.service foo@parameter2.service
...
, :
[Unit]
Description=bar target
Requires=multi-user.target
After=multi-user.target
AllowIsolate=yes
.service WantedBy=bar.target
:
[Unit]
Description=script description %I
[Service]
Type=simple
ExecStart=/script.py %i
Restart=on-failure
[Install]
WantedBy=bar.target
foo, , :
$ systemctl daemon-reload
$ systemctl enable foo@param1.service
$ systemctl enable foo@param2.service
$ systemctl start bar.target
:, .