Reply
Thread Tools
Posts: 566 | Thanked: 150 times | Joined on Dec 2007
#1
Hi all,

In order to find the cause of reboot loops I installed syslogkd. I can let it write logs to one of the SD cards. But after rebooting no new logs are written to it. I guess this is because the daemon tries to write the files before the SD card is mounted.

So my next idea was to automatically copy the logfiles from /var/log/ to the SD card as soon as it is mounted. But it won't work so far. To test using udev for this I have made these files:

/etc/udev/rules.d/91_backupsyslogs.rules :
Code:
KERNEL=="mmc1", RUN+="/usr/local/bin/backup_syslogs.sh"
/usr/local/bin/backup_syslogs.sh :
Code:
#!/bin/sh
if [ "${ACTION}" = "add" ] then
    datestring=`date '+%Y%m%d_%H%M%S'`
    echo "" > "/media/mmc1/test_${datestring}"
fi
When removing and inserting mmc1, or after rebooting no 'test..' file gets written to it like I would expect. Am I using the wrong string from "udevinfo -a -p /sys/block/mmcblk1" to test for in the .rules file? I have set the executable permission to both files. Are there better ways to do this?

Last edited by iamthewalrus; 2008-08-25 at 16:34.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#2
To answer the topic question:

If the card is a vfat card, edit /usr/sbin/mmc-mount and put "exec /usr/local/bin/backup_syslogs.sh" at the end. If it's an ext* one, edit /usr/sbin/osso-mmc-mount.sh and find the right section depending on fs to shove that line in.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Posts: 566 | Thanked: 150 times | Joined on Dec 2007
#3
Originally Posted by qwerty12 View Post
To answer the topic question:

If the card is a vfat card, edit /usr/sbin/mmc-mount and put "exec /usr/local/bin/backup_syslogs.sh" at the end. If it's an ext* one, edit /usr/sbin/osso-mmc-mount.sh and find the right section depending on fs to shove that line in.
That worked, thanks! Still it's curious that the udev method doesn't.
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#4
Originally Posted by iamthewalrus View Post
Still it's curious that the udev method doesn't.
Maybe mmc0 instead of mmc1 would work?
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Posts: 566 | Thanked: 150 times | Joined on Dec 2007
#5
Originally Posted by fanoush View Post
Maybe mmc0 instead of mmc1 would work?
That has no effect. Also I have an n800 with both SD cards inserted and the bug you linked to manifests itself only when one card is removed.
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#6
Originally Posted by iamthewalrus View Post
the bug you linked to manifests itself only when one card is removed.
This is correct for N800. On N810 it manifests itself only when external card is inserted (slots are physically swapped). Anyway, it doesn't matter here.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Posts: 566 | Thanked: 150 times | Joined on Dec 2007
#7
Calling my script from '/usr/sbin/mmc-mount' with 'exec' caused 'memory card corrupted or unformatted' error popups. Without 'exec' and with the output suppressed it works:
Code:
sh /usr/local/bin/backup_syslogs.sh &> /dev/null
I'll also try the sp-rich-core core-dump tool.
 

The Following User Says Thank You to iamthewalrus For This Useful Post:
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#8
You definitely don't want the 'exec' there.. it replaces the process (the original script) with the one you're calling, which isn't what you want to do - you just want to call that backup_syslogs.sh script and then go on with the original script (even if that's just to exit, if you placed that call at the end).

Just
Code:
/usr/local/bin/backup_syslogs.sh &> /dev/null
should be OK, if the backup_syslogs.sh script begins with
Code:
#!/bin/sh
and has the 'x' bit set (chmod a+x backup_syslogs.sh), unless you have /usr/local/bin on a vfat card, as those are mounted noexec. For such cases (no x-bit or noexec), using 'sh' to execute the script (as in your posting) will handle that.
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 

The Following 2 Users Say Thank You to TA-t3 For This Useful Post:
Reply

Tags
udev mounting


 
Forum Jump


All times are GMT. The time now is 12:51.