How to bind CPUAffinity dynamically for systemd sub-services

cn flag

I have a systemd as follows:

Requires=bob@0.service bob@1.service, bob@2.service

I want to set a two-cpu CPUAffinity for each of the bob@ services as follows:

CPUAffinity=0,4 # bob@0
CPUAffinity=1,5 # bob@1
CPUAffinity=2,6 # bob@2

My ideal goal would be to set two CPUS as follows:

CPUAffinity=%i %i+1

When I try the following to dynamically set one of the CPUS I get a parse error:


Is there a way to dynamically set the CPUAffinity?

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.