#!/bin/bash
#
# Comments to support chkconfig
# chkconfig: - 98 02
# description: your_prog_name service script
#
# Source function library.
. /etc/init.d/functions

### Default variables
prog_name="rinetd"
prog_path="/bin/${prog_name}"
pidfile="/var/run/${prog_name}.pid"
options="-c /etc/${prog_name}.conf"

# Check if requirements are met
[ -x "${prog_path}" ] || exit 1

RETVAL=0

start(){
  echo -n $"Starting $prog_name: "
  daemon $prog_path $options
  RETVAL=$?
  PID=$(pidof ${prog_path})
  [ ! -z "${PID}" ] && echo ${PID} > ${pidfile}
  echo
  [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog_name
  return $RETVAL
}

stop(){
  echo -n $"Shutting down $prog_name: "
  killproc -p ${pidfile}
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog_name
  return $RETVAL
}

reload(){
  echo -n $"Reloading config $prog_name:"
  kill -s HUP `cat $pidfile`
  echo 
  [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog_name
  return $RETVAL
}

restart() {
  stop
  start
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  reload)
    reload
    ;;
  status)
    status $prog_path
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $0 {start|stop|restart|status|reload}"
    RETVAL=1
esac

exit $RETVAL
Copyright © opschina.org 2017 with zzlyzq@gmail.com all right reserved,powered by Gitbook该文件修订时间: 2017-07-26 14:40:05

results matching ""

    No results matching ""