Saturday 5 November 2016

How to know which services are running?

Q. 59. How to know which services are running?

#!/bin/bash
service=service_name

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start

fi

No comments:

Post a Comment

Tricks and Tips