Tiny Core Linux
Tiny Core Base => TCB Talk => Topic started by: floppy on April 15, 2012, 09:55:08 AM
-
I am experiencing different install on different HW.
In case of frozen mouse, keyboard, screen.. it is a bit difficult to have a look at the log files (Xorg.0.log, dmesg).
So, is there any method to store different log files onto a directory on an USB stick for example?
Example by using a theoretical boot code "debug=/mnt/sda1" (which could become active/available by loading an extension debug.tcz on boot):
every 0,1 s different files would be written on the /mnt/sda1 devices with root access (dmesg, Xorg.0.log.. list to be defined). with that method, we could see what was the last event befor it froze or before the PC was shut off (after it freeze).
Is there a similar method in TinyCore?
(this question came up since I see that thread http://forum.tinycorelinux.net/index.php/topic,11530.msg60876.html#msg60876
-
dear floppy
you can place script opt_save_varlogs.sh with the following code to /opt
#!/bin/sh
while true; do
dmesg > /var/log/dmesg
cp -rf /var/log /etc/sysconfig/tcedir
sync
sleep 5
done
and add it run to bootlocal.sh
echo "/opt/opt_save_varlogs.sh &" >> /opt/bootlocal.sh
folder /var/log will saved every 5 sec to your usb stick in tce dir
also can add syslog bootcode to get system messages
-
also in tinycore have bootcode rsyslog which yet undocumented for some reason
rsyslog="OPTIONS"
where OPTIONS are syslogd options (see in tc-config)
tc@box:~$ syslogd --help
BusyBox v1.19.4 (2012-03-09 02:27:21 UTC) multi-call binary.
Usage: syslogd [OPTIONS]
System logging utility
(this version of syslogd ignores /etc/syslog.conf)
-n Run in foreground
-O FILE Log to FILE (default:/var/log/messages)
-l N Log only messages more urgent than prio N (1-8)
-S Smaller output
-s SIZE Max size (KB) before rotation (default:200KB, 0=off)
-b N N rotated logs to keep (default:1, max=99, 0=purge)
-R HOST[:PORT] Log to IP or hostname on PORT (default PORT=514/UDP)
-L Log locally and via network (default is network only if -R)
-D Drop duplicates
-C[size_kb] Log to shared mem buffer (use logread to read it)
-
i modified script opt_save_varlogs.sh for using with bootcode syslog[=folder]
where folder defines place on the boot device for /var/log storing
place script opt_save_varlogs.sh with the following code to /opt
#!/bin/sh
. /etc/init.d/tc-functions
checkroot
LOGDIR=`getbootparam syslog 2>/dev/null` || exit 1
DEVICE=`readlink /etc/sysconfig/tcedir | cut -f3 -d/`
[ "$DEVICE" == "tce" ] && ( [ -f /etc/sysconfig/cde ] && DEVICE=`cat /etc/sysconfig/cde | cut -f3 -d/` || exit 1 )
if [ -z "$(getbootparam rsyslog 2>/dev/null)" ]; then
/sbin/syslogd && echo "${GREEN}syslog started.${NORMAL}"
/sbin/klogd && echo "${GREEN}klog started.${NORMAL}"
fi
while true; do
dmesg > /var/log/dmesg
mkdir -p /mnt/$DEVICE/$LOGDIR/log
cp -rf /var/log /mnt/$DEVICE/$LOGDIR
sync
sleep 5
done
and add it run to bootlocal.sh
echo "nohup /opt/opt_save_varlogs.sh >/dev/null &" >> /opt/bootlocal.sh
now folder /var/log will be saved to specified folder on your boot usb stick every 5 sec
p.s.
script will works in core 4.2+
-
VERY good.
As an extension? .. (sorry.. much easier for transporting it from version to version..)
-
sorry floppy, i not quite understood
are you want have extension with this script?
-
by the way
to bind running this script with syslog bootcode
was beautiful but perhaps not most successful solution
through this syslog starts only after extensions loading
and therefore loses extensions loading log
correctly would be if script will launched
by other bootcode log={folder}
#!/bin/sh
. /etc/init.d/tc-functions
checkroot
LOG=`getbootparam log 2>/dev/null` || exit 1
DEV=`readlink /etc/sysconfig/tcedir | cut -f3 -d/` || DEV=`cat /opt/.tce_dir | cut -f3 -d/`
[ "$DEV" == "tce" ] && ( [ -f /etc/sysconfig/cde ] && DEV=`cat /etc/sysconfig/cde | cut -f3 -d/` || exit 1 )
while true; do
dmesg > /var/log/dmesg
mkdir -p /mnt/$DEV/$LOG/log
cp -rf /var/log /mnt/$DEV/$LOG
sync
sleep 5
done
can compare logs saved by this and previous script
-
sorry floppy, i not quite understood
are you want have extension with this script?
I mean:
- create a debuglog.tcz
- by installing that tcz onboot and using the bootcode log=<fiolder>
-
submit to repo extension
that contains a script with 10 lines
somehow not respectably :D
attach extensions to the forum
also prohibited as i understand
i attached script tc-log.sh
that creates extension tc-log.tcz
and adds it to on-boot list
the principle of using the same:
bootcode log={folder}
folder creates/exist on the boot device
/var/log will saved every 5 sec
-
Hi AbNoRMiS
attach extensions to the forum also prohibited as i understand
That is correct.
-
From now on you will be known as "the exploits master" ;D
-
mbr exploiter
don't make me laugh
because i can squirt
:D