#!/bin/sh
# 
# start system and kernel logging
#

#locate and source functions script
source `PATH=$INIT_D/:/sbin/init.d:/etc/init.d:/etc/rc.d type -p functions`

case "$1" in
  start)
     need $mounted_filesystems || exit_if_any_error
  
     #logging will work without the hostname being set but the logs will
     #not contain, the hostname with the messages.
     #Therefore we need hostname_available but do not exit_if_any_error
     need $hostname_available
     
     if [ ! -d /var/log ]; then
       echo -n 'No /var/log directory => logging daemons not started!'
       print_status skipped
       exit 2
     fi    
    
     echo 'Starting system log daemon...'
     loadproc syslogd -m 0 || exit_if_any_error

     echo 'Starting kernel log daemon...'
     loadproc klogd || exit_if_any_error
     ;;
  stop)
     echo 'Stopping kernel log daemon...'
     killproc klogd
     
     echo 'Stopping system log daemon...'
     killproc syslogd
     ;;
  reload)
     echo 'Telling klogd to reload symbols...'
     reloadproc klogd SIGUSR1
     
     echo 'Reinitializing system log daemon...'
     reloadproc syslogd
     ;;
  status)
     statusproc klogd
     statusproc syslogd
     ;;   
  *)
     exit 1
     ;;
esac
    
exit 0

