Does this mean you won't consider selection via an nvram variable? At one point, it looked like you would (Issue #519).
I might, it's just not a high priority at this point.
Does this mean you won't consider selection via an nvram variable? At one point, it looked like you would (Issue #519).
Hello,
thanks for all. I have found this solution : to copy a file of 30 Mb into jffs, then no more space for logfiles (sorry for my poor english).
By
#!/bin/sh
/usr/bin/logger -t $(basename $0) "started [$@]"
# Remount /jffs partition readonly
mount -o remount,ro,noatime /jffs
/usr/bin/logger -t $(basename $0) "finished [$@]"
#!/bin/sh
if ! [ -d /tmp/mnt/8GB_USB/rwjffs ]; then
# One-time setup of new jffs directory
mkdir /tmp/mnt/8GB_USB/rwjffs
# Copy the data
cp -fr /jffs/* /tmp/mnt/8GB_USB/rwjffs/
fi;
# Re-mount /jffs to r/w usb drive
mount -o rbind /tmp/mnt/8GB_USB/rwjffs /jffs
#!/bin/sh
ScriptDirName=`dirname $0`
BADScriptPath="/jffs/myscripts"
if [ "$ScriptDirName" != "$BADScriptPath" ] && [ "$PWD" != "$BADScriptPath" ]; then
# unmount usb r/w instance of /jffs
umount /jffs
# unmount flash r/o instance of /jffs if it is mounted
[B]# make sure this is the correct block device for your flash memory[/B]
umount /dev/mtdblock5
# mount the real /jffs as r/w
if ! [ -d /tmp/realjffs ]; then mkdir /tmp/realjffs; fi;
mount -t jffs2 -o rw,noatime /dev/mtdblock5 /tmp/realjffs
# copy the files to the real /jffs
cp /tmp/mnt/8GB_USB/rwjffs/scripts/* /tmp/realjffs/scripts/
cp /tmp/mnt/8GB_USB/rwjffs/configs/* /tmp/realjffs/configs/
# re-mount usb instance of /jffs
umount /tmp/realjffs
rmdir /tmp/realjffs
mount -o rbind /tmp/mnt/8GB_USB/rwjffs /jffs
echo "Done."
else
echo "Working directory and/or script path matches $BADScriptPath. We can't have that."
fi;
It does not work with the symlink. The link is rewritten by the log file.Just put in /jffs a symlink to /tmp/syslog.sys, if just want to disable it.
0 * * * * /jffs/scripts/syslog-rotate.sh #syslog-rotate#
#! /bin/sh
#set SYSLOG Directory
SYSLOGDIR=/tmp/mnt/OPTWARE/logs/
cd $SYSLOGDIR
# Rotate Logs if syslog.log-1 exists
if [ -s syslog.log-1 ]; then
# SET i to one less than the number of logs to keep. (i.e. "8" means 9 old logs will be kept)
for i in $(awk 'BEGIN { for ( i=8; i>0; i-- ) { print i; } }');
do if [ -f syslog.$i.log ]; then mv syslog.$i.log syslog.$(($i+1)).log; fi;
done
mv syslog.log-1 syslog.1.log
fi
#!/bin/sh
#
logger RedirectingSyslogd to USB
# Syslog.log source file
SOURCE=/tmp/syslog.log
# Syslog.log target file
SYSLOG=/tmp/mnt/OPTWARE/logs/syslog.log
#Stop existing syslogd
killall syslogd
# Add lines from tmp syslog to USB syslog and create symlink
if [ ! -L $SOURCE ]; then
cat $SOURCE >> $SYSLOG
# delete tmp syslog file
rm $SOURCE
# create symbolic link
ln -s $SYSLOG $SOURCE
fi
#restart syslogd with 4 MB file limit and log rotation enabled
syslogd -m 0 -S -O $SYSLOG -s 4096 -l 7 -b 1
#add cron job to rotate logs
if [ -s /jffs/scripts/syslog-rotate.sh ]; then
cru a syslog-rotate "0 * * * * /jffs/scripts/syslog-rotate.sh"
fi
#!/bin/sh
touch /tmp/000services-start
/usr/bin/killall syslogd
mkdir /tmp/log
syslogd -m 0 -S -O /tmp/log/syslog.log -s 256 -l 7
rm /tmp/syslog*
I too was concerned about the log being sent to JFFS. I looked into all the options as everyone else did here and came up with a simple approach. Just change the directory where syslog is logged. I did it with a services-start script in the /jffs/scripts directory:
Code:#!/bin/sh touch /tmp/000services-start /usr/bin/killall syslogd mkdir /tmp/log syslogd -m 0 -S -O /tmp/log/syslog.log -s 256 -l 7 rm /tmp/syslog*
Now the only log that is put into JFFS is at router startup. So you only get a write of the syslog to JFFS when you reboot the router.
#!/bin/sh
SOURCE=/tmp/syslog.log # original source of the syslog
SYSLOG=/tmp/mnt/RECOVERY/Syslog/syslog.log # destination of the syslog - need to by adjusted
/usr/bin/killall syslogd
syslogd -m 0 -S -O /tmp/mnt/RECOVERY/Syslog/syslog.log -s 256 -l 7
NOW=$(date +"%Y%m%d-%H%M%S") # current date and time
# mv $SYSLOG $SYSLOG-$NOW # rename the previous log with timestamp
# cp $SOURCE $SYSLOG # copy current syslog to the new location
cat $SOURCE >> $SYSLOG
rm $SOURCE # delete the syslog
ln -s $SYSLOG $SOURCE # create a symbolic link from the orginal syslog to the copied one
if [ "$?" -ne 0 ] # check for error
then
echo "Error in Syslog move! Script: $0" # display the error message
exit $?
else
echo "Syslog move OK. Script: $0" # display OK message
exit 0
fi
/usr/bin/logger -t $(basename $0) "started [$@]"
# Remount /jffs partition readonly
mount -o remount,ro,noatime /jffs
/usr/bin/logger -t $(basename $0) "finished [$@]"
It seems that by doing so, the log will not appear on the router web interface
I might, it's just not a high priority at this point.
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!