#!/bin/sh

##
# System Log
##

. /etc/rc.common

StartService ()
{
    ConsoleMessage "Starting system log"

    if [ -f /etc/syslog.conf ]; then
        if ! pid=$(GetPID syslog); then
            rm -f /dev/log
            syslogd
        fi
    else
        echo "Warning: syslogd was not started"
    fi
}

StopService ()
{
    if pid=$(GetPID syslog); then
        ConsoleMessage "Stopping system log"
        kill -TERM "${pid}"
    else
        echo "syslogd is not running."
    fi
}

RestartService ()
{
    if pid=$(GetPID syslog); then
        ConsoleMessage "Restarting system log"
        kill -HUP "${pid}"
    else
        StartService
    fi
}

RunService "$1"
