Score:0

Systemd: How to automatically start instantiated services after reboot?

sb flag

I have a systemd service file [email protected] like the following:

[Unit]
Description=...
After=network.target

[Service]
User=...
Group=www-data
WorkingDirectory=/home/...
ExecStart=...
Restart=always
RestartSec=1s

[Install]
WantedBy=multi-user.target

I start then multiple instances like this:

sudo systemctl start my_service@a
sudo systemctl start my_service@b
sudo systemctl start my_service@c

Unfortunately, when the server reboots, they don't get started again and I have to manually run the above commands one more time. Before I started using instantiated services, the service would automatically start.

Is there a way to make sure that all instances get started again when the machine reboots? Or should I take another approach for achieving that?

Versions: Ubuntu 18.04.4 LTS, systemd 237

Score:0
sb flag

Figured it out, forgot that I had to run enable in addition to start:

sudo systemctl enable my_service@a
sudo systemctl enable my_service@b
sudo systemctl enable my_service@c
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.