What is the best way in bash to check if a service is installed? It should work across both Red Hat (CentOS) and Ubuntu?
Thinking:
service="mysqld"if [ -f "/etc/init.d/$service" ]; then # mysqld service existsfi
Could also use the service
command and check the return code.
service mysqld statusif [ $? = 0 ]; then # mysqld service existsfi
What is the best solution?