2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00
fhem-mirror/fhem/webfrontend/pgm3/docs/logrotate/logrotate.fht.sh
rudolfkoenig 71fe020f84 Initial version
git-svn-id: https://svn.fhem.de/fhem/trunk@3 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2007-01-30 12:47:36 +00:00

25 lines
756 B
Bash
Executable File

#!/bin/bash
# this script should be installed in e.g. /etc/crontab:
# 0 3 * * * root /usr/local/bin/logrotate.wz.sh > /dev/null 2>&1
# then there are only about 5 days in the logfile for the FHT-Device
logs="adi bao bau leo wz wzo"
for fht in $logs
do
newlogs="0"
# first time
[[ ! -f /var/tmp/$fht.log.main ]] && cp -p /var/tmp/$fht.log /var/tmp/$fht.log.main
cat /var/tmp/$fht.log | while read line;
do
[[ "$newlogs" = "1" ]] && echo $line | egrep -v 'measured-temp: [0-2]\.' >>/var/tmp/$fht.log.main
[[ "$line" = "NEWLOGS" ]] && newlogs="1"
done;
# 4500 for about 5 days
tail -4500 /var/tmp/$fht.log.main >/var/tmp/$fht.log
echo "NEWLOGS" >>/var/tmp/$fht.log
done;