cancel
Showing results for 
Search instead for 
Did you mean: 
spurs
Flight Engineer
Flight Engineer
  • 1,088 Views

service status check

Jump to solution

I saw many questions asking to check status of specific service (if it's running or not)

in the playbook, are these same?

 

command: systemctl status postfix

command: /usr/bin/systemctl is-active postfix

 

the 2nd one is bit confusing. I don't know what exactly is-active does and if i can omit /usr/bin, so just make like

 

systemctl is-active postfix

 

Thanks!

Labels (1)
0 Kudos
1 Solution

Accepted Solutions
Fran_Garcia
Starfighter Starfighter
Starfighter
  • 1,064 Views

You can always check the man page for systemctl : 

is-active PATTERN...
Check whether any of the specified units are active (i.e. running). Returns an exit code 0 if at least one is active, or non-zero otherwise. Unless --quiet is specified, this will also print the current unit state to standard output.

 

Using the full path to the command is a best practise to avoid issues invoking the wrong command if the system has a munged shell, wrong environment variables (eg: PATH), etc.

View solution in original post

0 Kudos
1 Reply
Fran_Garcia
Starfighter Starfighter
Starfighter
  • 1,065 Views

You can always check the man page for systemctl : 

is-active PATTERN...
Check whether any of the specified units are active (i.e. running). Returns an exit code 0 if at least one is active, or non-zero otherwise. Unless --quiet is specified, this will also print the current unit state to standard output.

 

Using the full path to the command is a best practise to avoid issues invoking the wrong command if the system has a munged shell, wrong environment variables (eg: PATH), etc.

0 Kudos
Join the discussion
You must log in to join this conversation.