Starting Services That Should Be Running RHEL

I recently came across a server that ran services, I was not familiar with, and services were unclear as to the issues I was troubleshooting. As a quick fix, I decided to get a list of services that should be running and start any that were not from that list:

chkconfig --list | grep "2:on" | grep "3:on" | grep "4:on" | grep "5:on" | awk '{print "service " $1 " status"}' > status.sh

In some cases, the service was not listed as I had expected, so to get the list I had to run the following, where $3 is the service name from the prior commands. In some cases, I had to use $5, as history had a different output:

history | grep start | grep service | grep -v grep | awk '{print $5}' | sort | uniq |  awk '{print "service " $0 " status"}' > status.sh

Now we can find out which are running:

chmod +x status.sh 
./status.sh | grep " not " | awk '{print "service " $1 " start"}' > start.sh

Validate what you are starting, come on, be informed and intentful in what you are doing, and if safe, run the second and third command:

cat start.sh
chmod +x start.sh 
 ./start.sh

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *