As part of a provisioning script for CentOS 7 I am in need to have a one-liner that performs the following. Unfortunately, I have no clue how to achieve that.
- If httpd is running then stop it
- If httpd is not running then check if httpd is installed at all & start it
- ideally the result is logged into /log/httpd/ AND /&hostname/log/httpd/
Anyone able to help?
systemctl restart httpd.service?;or&&instead of using newlines.