I do not know the service\'s name, but would like to stop the service by checking its status.
For example, if I want to check if the PostgreSQL service is running or no
Dirty way to find running services. (sometime it is not accurate because some custom script doesn't have |status| option)
[root@server ~]# for qw in `ls /etc/init.d/*`; do $qw status | grep -i running; done
auditd (pid 1089) is running...
crond (pid 1296) is running...
fail2ban-server (pid 1309) is running...
httpd (pid 7895) is running...
messagebus (pid 1145) is running...
mysqld (pid 1994) is running...
master (pid 1272) is running...
radiusd (pid 1712) is running...
redis-server (pid 1133) is running...
rsyslogd (pid 1109) is running...
openssh-daemon (pid 7040) is running...