#!/bin/sh # # srestart - restart specified service # usage(){ echo "Usage: srestart [SERVICE]..." echo "Restart the service specificed as argument, if the service" echo "has a service-file installed in /etc/rc.d/services/." echo echo " -h, --help print this help and exit" echo " -v, --version output version information and exit" echo echo "Report bugs to " exit 1 } displayversion(){ echo "srestart (rltools) #VERSION#" exit 0 } if [ "$1" = "-h" -o "$1" = "--help" ]; then usage fi if [ "$1" = "-v" -o "$1" = "--version" ]; then displayversion fi if [ -z $1 ]; then echo "srestart: error: missing option" echo "Try 'srestart --help' for more information." exit 1 fi if [ -f /etc/rc.d/services/$1.service ]; then echo "restarting service $1..." /etc/rc.d/services/$1.service stop sleep 1 /etc/rc.d/services/$1.service start exit 0 else echo "srestart: $1: no such service." exit 1 fi