Sunday, August 3, 2008

service command for debian/ubuntu

I almost worked 7years on redhat platform linux , but we i started exploring ubuntu i was surprised that their was no command like "service" to check the services.

So i immediately write one very simple bash script "service" command.

This command with do most of the operations as redhat service command do.

#######################################################################
#!/bin/bash

if [ "$2" == "status" ]; then

PID=`pidof $1`
if [ "$PID" == "" ]; then
echo "Service $1 is not running......."
else
echo "Serivce $1 is running with $PID pid...."
fi

else

sh /etc/init.d/$1 $2

fi
##############################################################

Contribution is very much welcome. Kindly reply the blog for your contribution.

1 comment:

Anonymous said...

Nice