#!/bin/sh 
# $ Id $
# Solaris 10 /lib/svc/method for syslog-ng
# Adapted to syslog-ng by DJ 06/01/2005
#
SYSLOGPROG=/usr/local/sbin/syslog-ng
SYSLOGCONF=/etc/syslog-ng/syslog-ng.conf
SYSLOGOPTS=""
#SYSLOGOPTS="-f /etc/syslog-ng/syslog-ng.conf -p /var/run/syslog-ng.pid"

. /lib/svc/share/smf_include.sh

if [ ! -f $SYSLOGCONF ]; then
   echo 'syslog-ng no config file, not starting!'
   exit $SMF_EXIT_ERR_CONFIG
   fi

if [ ! -f $SYSLOGPROG ]; then
   echo 'can not find the syslog-ng program file! [ $SYSLOGPROG ]'
   exit $SMF_EXIT_ERR_PERM
   fi

echo 'syslog-ng service starting.'

#
# Before syslog-ng starts, save any messages from previous
# crash dumps so that messages appear in chronological order.
#
if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
   /usr/bin/savecore -m
   if [ -r /etc/dumpadm.conf ]; then
      . /etc/dumpadm.conf
      [ -n "$DUMPADM_DEVICE" -a \
      "x$DUMPADM_DEVICE" != xswap ] && \
      /usr/bin/savecore -m -f $DUMPADM_DEVICE
      fi
   fi

if [ ! -f /var/adm/messages ]; then
   /usr/bin/cp /dev/null /var/adm/messages
   /usr/bin/chmod 0644 /var/adm/messages
   fi

$SYSLOGPROG $SYSLOGOPTS

