Service Command in /etc/init.d/

Posted: 30 Aug 2005

Anyone who has used RedHat or Fedora on the command line will have used the service command for stopping/starting/restarting or displaying the status of a service in /etc/init.d/.

Here is a handy shell script with root as its owner and group which you can save as /usr/sbin/service to perform the same activities on SUSE Linux.

#!/bin/bash
#/usr/sbin/service

if [ $USER != "root" ]
then
  echo "Must be in a root login shell to run $0"
  exit
fi

if [ $# -lt 2 ]
then
  echo "Usage: $0  service_name  stop/start/restart/status"
  exit
fi

set -e
/etc/init.d/$1 $2









Informacja z serwisu http://www.djack.com.pl