Syslog in Telem Devices

From Phobos Wiki
Revision as of 13:20, 24 February 2015 by MarkTomm (talk | contribs) (Uus lehekülg: 'In telem devices, syslog is stared atr boot in the S01logging script located in /etc/init.d. <pre> root@telem-gw6e /home/martem $ cat /etc/init.d/S01logging #!/bin/sh # # Start ...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In telem devices, syslog is stared atr boot in the S01logging script located in /etc/init.d.

root@telem-gw6e /home/martem $ cat /etc/init.d/S01logging
#!/bin/sh
#
# Start logging
#

# Read config file if it is present.
if [ -r /etc/default/syslogd ]
then
    . /etc/default/syslogd
fi

case "$1" in
  start)
    echo -n "Starting logging: "

    ! rm -rf /tmp/log
    ! rm -rf /var/log
    mkdir -p /tmp/log
    ln -s /tmp/log /var/log
    ln -s /var/local/telem/log /var/log/telem
    touch /var/log/wtmp


    if [ "$SYSLOGD_REMOTE" = "yes" ]; then
    start-stop-daemon -S -q -p /var/run/syslog.pid --exec /sbin/syslogd -- -O /var/log/telem/messages -s 1024 -b 3 -L -R $SYSLOGD_REMOTE_SERVER:514
    else
    start-stop-daemon -S -q -p /var/run/syslog.pid --exec /sbin/syslogd -- -O /var/log/telem/messages -s 1024 -b 3
    fi

    ln -s /var/log/telem/messages /var/log/messages

        if [ "$TELEM_GW_SYSLOG_REMOTE" = "yes" ]; then
        /usr/local/bin/telem/telem_syslog.sh $TELEM_GW_SYSLOG_REMOTE_SERVER &> /dev/null &
    fi
    start-stop-daemon -S -q -p /var/run/klogd.pid --exec /sbin/klogd
    echo "OK"
    ;;
  stop)
    echo -n "Stopping logging: "
    start-stop-daemon -K -q -p /var/run/syslog.pid
    start-stop-daemon -K -q -p /var/run/klogd.pid
        killall -9 syslogd
        killall -9 klogd
        killall -9 telem_syslog.sh
    killall -9 socat
    echo "OK"
    ;;
  restart|reload)
    ;;
  *)
    echo $"Usage: $0 {start|stop|restart}"
    exit 1
esac

exit $?

MarkTomm 24. veebruar 2015, kell 15:20 (EET)