Template service:
/etc/systemd/system/[email protected]
[Unit]
Description=manages the NAME service, instance %i
PartOf=NAME.target
[Service]
Type=simple
User=root
WorkingDirectory=/PATH/TO/SERVICE
ExecStart=./SERVICE
Restart=always
TimeoutStartSec=10
RestartSec=10
[Install]
WantedBy=NAME.target
Dummy service to run the enabled template services:
/etc/systemd/system/NAME.target
[Install]
WantedBy=multi-user.target
[Unit]
Description=NAME service
You may then enable multiple instances:
systemctl enable NAME@{1..7}.service
the main dummy target: systemctl enable NAME.target
..and finally start the service: systemctl start NAME.target
(note: you dont seem to be able to use the service
command for this)