#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

case "$1" in
	start)
		echo "Starting system logging."
		if ! [ -d /www/html/log ]; then
			mkdir -p /www/html/log
		fi
#		dmesg 2>/dev/null > /var/log/dmesg

# Start logging daemon with custom opionts:
# -O LogFileName: sets file name. Default is "/var/log/messages" for the current file. When this file size reaches maximum, it is renamed to "/var/log/messages.0".
# -s MaxFileSizeInKylobytes: sets file size limit.
# -b MaxNumberOfFiles (1 means 1 file is current, and file with postfix index 0 is previous file)
# -l LogLevel (3 - Error, 4 - Warning, 5 - Notice, 6 - Info, 7 - Debug)
# -S : no value provided. Produces smaller output (does not include log level and host name in each line).
		syslogd -s 32 -b 1 -l 6 -S -O /www/html/log/messages.txt
# Options which are not supported:
# -f /etc/syslog.conf

# Note: To save space in RFS, do not create wtmp/utmp.
##		touch /var/log/wtmp 2>/dev/null
##		touch /var/run/utmp 2>/dev/null
	;;
	stop)
		echo "Stopping system logging."
		killall syslogd
	;;
	
	*)
	;;
esac

