PDA

Bekijk de volledige versie : HOW TO: Manually add custom messages to the syslog



LeperKing
14-01-2007, 15:40
Thanks to the help from snowbat from boards.ie, he answered (http://www.boards.ie/vbulletin/showthread.php?t=2055038172) my question about adding custom messages to the syslog.

1. Have the custom firmware setup from kfurge.
2. Setup custom firmware to at least step 3.8.
3. Ensure the paths are setup ie:


export PATH=/opt/bin:${PATH}
export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}


4. To add messages to the syslog.....


echo "Hello world" | logger -p local0.notice

Check your the log by either "logread" or the routers webpage, and your message should be there!

CAVEAT: I've only just discovered this (havn't tested this in rc.local yet!) and I hope the more experienced linux guys can explain better about how to use this feature.

Thanks,
LK.

LeperKing
15-01-2007, 12:20
I can confirm that this will work in rc.local as well. :D

E.g.



#!/bin/sh

pool=`nvram get apps_pool`
share=`nvram get apps_share`
internal_hdd=/dev/ide/host2/bus0/target0/lun0/disc

if [ \! -f /tmp/rc.local.done ]; then

# Indicate we've already done this
touch /tmp/rc.local.done

#
# Mount /opt and connect in various system files
#
if [ -e /shares/${pool}/opt ]; then
mount -o bind /shares/${pool}/opt /opt

cat /proc/mounts > /opt/etc/fstab

ln -s /opt/etc/shells /tmp/shells
ln -s /opt/etc/fstab /tmp/fstab

export PATH=/opt/bin:/opt/sbin:${PATH}
export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}
fi

# Start utelnetd on local interface only!
/apps/bin/utelnetd -i br0 &

# Sleep for a little bit to not interfere with normal system startup
# before we kill a bunch of Asus processes.
sleep 5

# The killing of watchdog is necessary
# to allow the disk to spin down (watchdog is a horribly written hack
# anyway!)
killall -q -9 watchdog

# Do the necessary steps so the internal HDD will spin down
mount -o remount,noatime,nodiratime /shares/${pool}
hdparm -S 180 ${internal_hdd}
smartctl -dT ${internal_hdd}

# Add confirmation that rc.local was executed
echo "rc.local executed" | logger -p local0.notice

fi

amccombs
29-11-2009, 15:37
How can this WL-700gE router not show incoming and outgoing packets? :mad:

Isn't that just a basic feature, it is in my old Linksys that I got 10 years ago, without logs is like buying a car without a gas gauge. :(