Hi guys,
I noticed that my MiniDlna file reached about 400Mb.
Is there any way to automatically look after the various log files and rotate them or just cut them?
Being NAS that would come handy not to waste space.
Thanks,
MDI
#!/bin/sh
if [ $# != 1 ]
then
MSIZE=1024
else
if [ $(echo $1 | grep -v [a-Z] | wc -l) -eq 0 ]
then
MSIZE=1024
else
MSIZE=$1
fi
fi
LOG='/share/1000/minidlna/database/minidlna.'
echo ${LOG}log
if [ -f ${LOG}log ]
then
SIZELOG=`du -b ${LOG}log|cut -f1`
SIZELOG=`expr $SIZELOG / 1024`
echo log size: $SIZELOG kB
if [ $SIZELOG -gt $MSIZE ]
then
cp -f ${LOG}log ${LOG}0
echo '' > ${LOG}log
echo Log has been move ...
fi
else
echo Log not found
fi
mdi wrote:Hi guys,
I noticed that my MiniDlna file reached about 400Mb.
Is there any way to automatically look after the various log files and rotate them or just cut them?
Being NAS that would come handy not to waste space.
Thanks,
MDI
mdi wrote:..where my_rotation_script.sh operates on 1 file given as a parameter.
In this case the script doesn't even have to check the sizes, it must only "backup" the log and touch a new log file, very simple.
I'm not sure if that is safe/appropriate.... (suggestions welcomed) :)
find /share/1000/minidlna/database -name "*.log" -size '+1024k' -exec my_rotation_script.sh {} \;
/bin/sh /share/1000/fvdw/my_rotation_script.sh
Return to Lacie Network Space vs2 and max version
Users browsing this forum: Bing Bot and 12 guests