"systemctl start service" when service already started

user2267379 asked:

I, what happen’s precisely when you run systemctl start apache2 (or other service) while service already started ?

Can it cause trouble to start several hundred times a day apache2 service? (to prevent the service from shutting down) or can it use memory or be dangerous?

My answer:


Why don’t you just use systemctl is-active to check whether it is running?

For example:

systemctl is-active --quiet apache2 || systemctl start apache2

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.