Jump to content

A noob question about systemctl (ubuntu)

Go to solution Solved by newgeneral10,

Assuming the service file was written correctly, then yes, adding the @prod part means you won't start or enable any @test parts and vice versa

Hello,

 

So I have a service I can enable like this

systemctl start my-service@prod

so, you guessed it, it has prod, qa and test.

 

But is this the correct way to enable only prod?

systemctl enable my-service@prod

Or will this fail / enable all of them?

Back-end developer, electronics "hacker"

Link to comment
https://linustechtips.com/topic/956748-a-noob-question-about-systemctl-ubuntu/
Share on other sites

Link to post
Share on other sites

systemctl enable

makes it so that, when the conditions for starting a service, which are defined in its unit file, are met, it is started

systemctl start

starts a service manually

 

An enabled service won't automatically start at the moment of being enabled nor will a started service automatically  become enabled.

Link to post
Share on other sites

8 minutes ago, Granular said:

systemctl enable

makes it so that, when the conditions for starting a service, which are defined in its unit file, are met, it is started


systemctl start

starts a service manually

 

An enabled service won't automatically start at the moment of being enabled nor will a started service automatically  become enabled.

I know that, but I'm asking if this is the correct way for multiple instances.

Back-end developer, electronics "hacker"

Link to post
Share on other sites

Just now, Granular said:

Do you? You referred to both commands as enabling a service.

 

58 minutes ago, Joveice said:

 

But is this the correct way to enable only prod?


systemctl enable my-service@prod

Or will this fail / enable all of them?

 

Back-end developer, electronics "hacker"

Link to post
Share on other sites

3 minutes ago, newgeneral10 said:

Are you asking about the @prod part of it?  if not you can use


systemctl enable --now thing

and be done with it.

I'm wondering about the @prod part of it, as I only want to enable 1 of them to start when the system starts and not the others.

Back-end developer, electronics "hacker"

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×