"systemctl start service" when service already started
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?
Solution 1:
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