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!
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.
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.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.