[leaf-commits] src/bering-uclibc4/source/etc/init.d syslog-ng, NONE, 1.1

KP Kirchd?rfer <[email protected]>
Newsgroups gmane.linux.leaf.cvs
Message-ID <[email protected]>
Update of /cvsroot/leaf/src/bering-uclibc4/source/etc/init.d
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7326

Added Files:
	syslog-ng 
Log Message:
fix path


--- NEW FILE: syslog-ng ---
#! /bin/sh
#
# skeleton	example file to build /etc/init.d/ scripts.
#		This file should be used to construct scripts for /etc/init.d.
#
#		Written by Miquel van Smoorenburg <[email protected]>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <[email protected]>.
#
# Version:	@(#)skeleton  1.8  03-Mar-1998  [email protected]
#
# This file was customized by SZALAY Attila <[email protected]>
RCDLINKS="2,S00 0,K99"

PATH=/sbin:/bin:/usr/sbin:/usr/bin
test -f /sbin/syslog-ng || exit 0
#we source /etc/default/syslog-ng if exists
[ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng

case "x$CONSOLE_LOG_LEVEL" in
  x[0-7])
    dmesg -n $CONSOLE_LOG_LEVEL
    ;;
  x)
    ;;
  *)
    echo "CONSOLE_LOG_LEVEL is of unaccepted value."
    ;;
esac

if [ -n "$KERNEL_RIGNBUF_SIZE" ]
then
  echo "KERNEL_RINGBUF_SIZE option is useless and therefore removed."
fi

# stop syslog-ng before changing its PID file!
PIDFILE="/var/run/syslog-ng.pid"

SYSLOGNG="/sbin/syslog-ng"
NAME="syslog-ng"

create_xconsole() {
  if [ ! -e /dev/xconsole ]
  then
    mknod -m 640 /dev/xconsole p
  fi
}
                                
syslogng_start() {
    echo -n "Starting system logging: $NAME"
    start-stop-daemon --start --quiet --exec "$SYSLOGNG" --pidfile "$PIDFILE" -- -p "$PIDFILE" \
      || { echo " start failed."; return 1; }
    echo "."
    return 0
}

syslogng_stop() {
    echo -n "Stopping system logging: $NAME"
    start-stop-daemon --stop --quiet --name "$NAME" --retry 3 --pidfile "$PIDFILE" || { echo " not running."; return 1; }
    echo "."
    rm -f "$PIDFILE"
    return 0
}

syslogng_reload() {
    if /sbin/syslog-ng -s
    then
      start-stop-daemon --stop --signal 1 --quiet --exec "$SYSLOGNG" --pidfile "$PIDFILE" || return 1
      return 0
    else
      echo "Cannot load /etc/syslog-ng/syslog-ng.conf"
      return 1
    fi
}


case "$1" in
  start)
    create_xconsole
    syslogng_start || exit 1
    ;;
  stop)
    syslogng_stop || exit 1
    ;;
  reload|force-reload)
    syslogng_reload || exit 1
    ;;
  restart)
    syslogng_stop
    syslogng_start || exit 1
    ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2
    exit 1
    ;;
esac

exit 0



------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.