Why the line of Active: active (running) just show running or dead when I sytemctl status?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am trying to check the state of systemd service(test.service) by systemctl status test.service.But why the line of Active: active (running) just show running or dead rather than starting/stopping/running/dead?







share|improve this question



















  • The current state of a service such as starting/started/running/stopping/stopped
    – user289678
    May 8 at 6:19














up vote
0
down vote

favorite












I am trying to check the state of systemd service(test.service) by systemctl status test.service.But why the line of Active: active (running) just show running or dead rather than starting/stopping/running/dead?







share|improve this question



















  • The current state of a service such as starting/started/running/stopping/stopped
    – user289678
    May 8 at 6:19












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to check the state of systemd service(test.service) by systemctl status test.service.But why the line of Active: active (running) just show running or dead rather than starting/stopping/running/dead?







share|improve this question











I am trying to check the state of systemd service(test.service) by systemctl status test.service.But why the line of Active: active (running) just show running or dead rather than starting/stopping/running/dead?









share|improve this question










share|improve this question




share|improve this question









asked May 8 at 5:47









user289678

52




52











  • The current state of a service such as starting/started/running/stopping/stopped
    – user289678
    May 8 at 6:19
















  • The current state of a service such as starting/started/running/stopping/stopped
    – user289678
    May 8 at 6:19















The current state of a service such as starting/started/running/stopping/stopped
– user289678
May 8 at 6:19




The current state of a service such as starting/started/running/stopping/stopped
– user289678
May 8 at 6:19










2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










It does. I guess you're holding it wrong.



$ systemd-run --user --no-block --service=oneshot sleep 10
Running as unit: run-r0b9dce0a8bd649d4a2e91d23fe757937.service
$ systemctl status --user run-r0b9dce0a8bd649d4a2e91d23fe757937.service
● run-r0b9dce0a8bd649d4a2e91d23fe757937.service - /usr/bin/sleep 10
Loaded: loaded (/run/user/1001/systemd/transient/run-r0b9dce0a8bd649d4a2e91d23fe757937.service; transient)
Transient: yes
Active: activating (start) since Thu 2018-05-17 10:49:43 BST; 9s ago
Main PID: 7949 (sleep)
CGroup: /user.slice/user-1001.slice/user@1001.service/run-r0b9dce0a8bd649d4a2e91d23fe757937.service
└─7949 /usr/bin/sleep 10

May 17 10:49:43 alan-laptop systemd[1667]: Starting /usr/bin/sleep 10...


Specifically, if you want systemd to be able to tell whether your service is started or starting, your service needs to actually tell it somehow. systemd supports a few different ways of this. The answer linked here shows one of them: "How can I show current service state of systemd service?", it shows how you can do this when writing a service daemon (long-running process) in either a shell script or in C.






share|improve this answer























  • Yes. it's my misunderstanding.And thanks for your words,I have got it.
    – user289678
    May 18 at 6:51

















up vote
0
down vote













The status of your service will be the current status. To see when the service was in fact started, check your journal log:



journalctl | grep test.service


This will show you when the service was started, and at this stage the status would have been in the activating stage.






share|improve this answer





















  • Thanks ! Can I read the log by line in my code ,so that I can do something by it's content.
    – user289678
    May 9 at 3:40










  • Try to format your questions on Stackexchange with a definite problem, and some context to help us find a definite solution, rather than creating a discussion. You can read the log line by line after the fact, but that's another rabbit hole that we can't discuss here.
    – YodaScholtz
    May 9 at 5:50










  • OK, thank you !
    – user289678
    May 9 at 8:44










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442469%2fwhy-the-line-of-active-active-running-just-show-running-or-dead-when-i-sytemc%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










It does. I guess you're holding it wrong.



$ systemd-run --user --no-block --service=oneshot sleep 10
Running as unit: run-r0b9dce0a8bd649d4a2e91d23fe757937.service
$ systemctl status --user run-r0b9dce0a8bd649d4a2e91d23fe757937.service
● run-r0b9dce0a8bd649d4a2e91d23fe757937.service - /usr/bin/sleep 10
Loaded: loaded (/run/user/1001/systemd/transient/run-r0b9dce0a8bd649d4a2e91d23fe757937.service; transient)
Transient: yes
Active: activating (start) since Thu 2018-05-17 10:49:43 BST; 9s ago
Main PID: 7949 (sleep)
CGroup: /user.slice/user-1001.slice/user@1001.service/run-r0b9dce0a8bd649d4a2e91d23fe757937.service
└─7949 /usr/bin/sleep 10

May 17 10:49:43 alan-laptop systemd[1667]: Starting /usr/bin/sleep 10...


Specifically, if you want systemd to be able to tell whether your service is started or starting, your service needs to actually tell it somehow. systemd supports a few different ways of this. The answer linked here shows one of them: "How can I show current service state of systemd service?", it shows how you can do this when writing a service daemon (long-running process) in either a shell script or in C.






share|improve this answer























  • Yes. it's my misunderstanding.And thanks for your words,I have got it.
    – user289678
    May 18 at 6:51














up vote
0
down vote



accepted










It does. I guess you're holding it wrong.



$ systemd-run --user --no-block --service=oneshot sleep 10
Running as unit: run-r0b9dce0a8bd649d4a2e91d23fe757937.service
$ systemctl status --user run-r0b9dce0a8bd649d4a2e91d23fe757937.service
● run-r0b9dce0a8bd649d4a2e91d23fe757937.service - /usr/bin/sleep 10
Loaded: loaded (/run/user/1001/systemd/transient/run-r0b9dce0a8bd649d4a2e91d23fe757937.service; transient)
Transient: yes
Active: activating (start) since Thu 2018-05-17 10:49:43 BST; 9s ago
Main PID: 7949 (sleep)
CGroup: /user.slice/user-1001.slice/user@1001.service/run-r0b9dce0a8bd649d4a2e91d23fe757937.service
└─7949 /usr/bin/sleep 10

May 17 10:49:43 alan-laptop systemd[1667]: Starting /usr/bin/sleep 10...


Specifically, if you want systemd to be able to tell whether your service is started or starting, your service needs to actually tell it somehow. systemd supports a few different ways of this. The answer linked here shows one of them: "How can I show current service state of systemd service?", it shows how you can do this when writing a service daemon (long-running process) in either a shell script or in C.






share|improve this answer























  • Yes. it's my misunderstanding.And thanks for your words,I have got it.
    – user289678
    May 18 at 6:51












up vote
0
down vote



accepted







up vote
0
down vote



accepted






It does. I guess you're holding it wrong.



$ systemd-run --user --no-block --service=oneshot sleep 10
Running as unit: run-r0b9dce0a8bd649d4a2e91d23fe757937.service
$ systemctl status --user run-r0b9dce0a8bd649d4a2e91d23fe757937.service
● run-r0b9dce0a8bd649d4a2e91d23fe757937.service - /usr/bin/sleep 10
Loaded: loaded (/run/user/1001/systemd/transient/run-r0b9dce0a8bd649d4a2e91d23fe757937.service; transient)
Transient: yes
Active: activating (start) since Thu 2018-05-17 10:49:43 BST; 9s ago
Main PID: 7949 (sleep)
CGroup: /user.slice/user-1001.slice/user@1001.service/run-r0b9dce0a8bd649d4a2e91d23fe757937.service
└─7949 /usr/bin/sleep 10

May 17 10:49:43 alan-laptop systemd[1667]: Starting /usr/bin/sleep 10...


Specifically, if you want systemd to be able to tell whether your service is started or starting, your service needs to actually tell it somehow. systemd supports a few different ways of this. The answer linked here shows one of them: "How can I show current service state of systemd service?", it shows how you can do this when writing a service daemon (long-running process) in either a shell script or in C.






share|improve this answer















It does. I guess you're holding it wrong.



$ systemd-run --user --no-block --service=oneshot sleep 10
Running as unit: run-r0b9dce0a8bd649d4a2e91d23fe757937.service
$ systemctl status --user run-r0b9dce0a8bd649d4a2e91d23fe757937.service
● run-r0b9dce0a8bd649d4a2e91d23fe757937.service - /usr/bin/sleep 10
Loaded: loaded (/run/user/1001/systemd/transient/run-r0b9dce0a8bd649d4a2e91d23fe757937.service; transient)
Transient: yes
Active: activating (start) since Thu 2018-05-17 10:49:43 BST; 9s ago
Main PID: 7949 (sleep)
CGroup: /user.slice/user-1001.slice/user@1001.service/run-r0b9dce0a8bd649d4a2e91d23fe757937.service
└─7949 /usr/bin/sleep 10

May 17 10:49:43 alan-laptop systemd[1667]: Starting /usr/bin/sleep 10...


Specifically, if you want systemd to be able to tell whether your service is started or starting, your service needs to actually tell it somehow. systemd supports a few different ways of this. The answer linked here shows one of them: "How can I show current service state of systemd service?", it shows how you can do this when writing a service daemon (long-running process) in either a shell script or in C.







share|improve this answer















share|improve this answer



share|improve this answer








edited May 17 at 9:55


























answered May 17 at 9:50









sourcejedi

18.2k32475




18.2k32475











  • Yes. it's my misunderstanding.And thanks for your words,I have got it.
    – user289678
    May 18 at 6:51
















  • Yes. it's my misunderstanding.And thanks for your words,I have got it.
    – user289678
    May 18 at 6:51















Yes. it's my misunderstanding.And thanks for your words,I have got it.
– user289678
May 18 at 6:51




Yes. it's my misunderstanding.And thanks for your words,I have got it.
– user289678
May 18 at 6:51












up vote
0
down vote













The status of your service will be the current status. To see when the service was in fact started, check your journal log:



journalctl | grep test.service


This will show you when the service was started, and at this stage the status would have been in the activating stage.






share|improve this answer





















  • Thanks ! Can I read the log by line in my code ,so that I can do something by it's content.
    – user289678
    May 9 at 3:40










  • Try to format your questions on Stackexchange with a definite problem, and some context to help us find a definite solution, rather than creating a discussion. You can read the log line by line after the fact, but that's another rabbit hole that we can't discuss here.
    – YodaScholtz
    May 9 at 5:50










  • OK, thank you !
    – user289678
    May 9 at 8:44














up vote
0
down vote













The status of your service will be the current status. To see when the service was in fact started, check your journal log:



journalctl | grep test.service


This will show you when the service was started, and at this stage the status would have been in the activating stage.






share|improve this answer





















  • Thanks ! Can I read the log by line in my code ,so that I can do something by it's content.
    – user289678
    May 9 at 3:40










  • Try to format your questions on Stackexchange with a definite problem, and some context to help us find a definite solution, rather than creating a discussion. You can read the log line by line after the fact, but that's another rabbit hole that we can't discuss here.
    – YodaScholtz
    May 9 at 5:50










  • OK, thank you !
    – user289678
    May 9 at 8:44












up vote
0
down vote










up vote
0
down vote









The status of your service will be the current status. To see when the service was in fact started, check your journal log:



journalctl | grep test.service


This will show you when the service was started, and at this stage the status would have been in the activating stage.






share|improve this answer













The status of your service will be the current status. To see when the service was in fact started, check your journal log:



journalctl | grep test.service


This will show you when the service was started, and at this stage the status would have been in the activating stage.







share|improve this answer













share|improve this answer



share|improve this answer











answered May 8 at 10:33









YodaScholtz

1262




1262











  • Thanks ! Can I read the log by line in my code ,so that I can do something by it's content.
    – user289678
    May 9 at 3:40










  • Try to format your questions on Stackexchange with a definite problem, and some context to help us find a definite solution, rather than creating a discussion. You can read the log line by line after the fact, but that's another rabbit hole that we can't discuss here.
    – YodaScholtz
    May 9 at 5:50










  • OK, thank you !
    – user289678
    May 9 at 8:44
















  • Thanks ! Can I read the log by line in my code ,so that I can do something by it's content.
    – user289678
    May 9 at 3:40










  • Try to format your questions on Stackexchange with a definite problem, and some context to help us find a definite solution, rather than creating a discussion. You can read the log line by line after the fact, but that's another rabbit hole that we can't discuss here.
    – YodaScholtz
    May 9 at 5:50










  • OK, thank you !
    – user289678
    May 9 at 8:44















Thanks ! Can I read the log by line in my code ,so that I can do something by it's content.
– user289678
May 9 at 3:40




Thanks ! Can I read the log by line in my code ,so that I can do something by it's content.
– user289678
May 9 at 3:40












Try to format your questions on Stackexchange with a definite problem, and some context to help us find a definite solution, rather than creating a discussion. You can read the log line by line after the fact, but that's another rabbit hole that we can't discuss here.
– YodaScholtz
May 9 at 5:50




Try to format your questions on Stackexchange with a definite problem, and some context to help us find a definite solution, rather than creating a discussion. You can read the log line by line after the fact, but that's another rabbit hole that we can't discuss here.
– YodaScholtz
May 9 at 5:50












OK, thank you !
– user289678
May 9 at 8:44




OK, thank you !
– user289678
May 9 at 8:44












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442469%2fwhy-the-line-of-active-active-running-just-show-running-or-dead-when-i-sytemc%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?