Initial version
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@3 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
10
webfrontend/pgm3/docs/logrotate/README
Normal file
10
webfrontend/pgm3/docs/logrotate/README
Normal file
@@ -0,0 +1,10 @@
|
||||
If the files are too big the system will be slower than usual.
|
||||
|
||||
In the config.php it is now possible to automatic logrotate the HMS, FHT and KS300-Logs. But it is only possible if the user of the pgm3 (e.g. wwwrun) has the rights to write the logfiles from fhz1000.pl (user=???????)
|
||||
|
||||
If you want do that manually then read the enclosed examples for your crontab.
|
||||
|
||||
Every Linux-System normally has a logrotate-Daemon. Put the fhz1000.logrotate in your /etc/logrotate.d/ to lograte the fhz1000.cfg and edit it or use the builtin method: "logfile /tmp/fhz1000-%Y-%m.log"
|
||||
|
||||
|
||||
|
||||
11
webfrontend/pgm3/docs/logrotate/fhz1000.logrotate
Normal file
11
webfrontend/pgm3/docs/logrotate/fhz1000.logrotate
Normal file
@@ -0,0 +1,11 @@
|
||||
/var/tmp/fhz1000.log {
|
||||
rotate 6
|
||||
size 2M
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
postrotate
|
||||
[[ `ps -ef | grep fhz1000.pl | grep -v grep` ]] && \
|
||||
/etc/init.d/fhz1000 restart
|
||||
endscript
|
||||
}
|
||||
24
webfrontend/pgm3/docs/logrotate/logrotate.fht.sh
Executable file
24
webfrontend/pgm3/docs/logrotate/logrotate.fht.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/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;
|
||||
30
webfrontend/pgm3/docs/logrotate/logrotate.hms100.ks300.sh
Executable file
30
webfrontend/pgm3/docs/logrotate/logrotate.hms100.ks300.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# this script should be installed in e.g. /etc/crontab:
|
||||
# 0 3 * * * root /usr/local/bin/logrotate.hms100.ks300.sh > /dev/null 2>&1
|
||||
# then there are only about 4 days in the logfile for the HMS/KS300-Device
|
||||
|
||||
logpath=/var/tmp
|
||||
logs="heating laundry ks300"
|
||||
|
||||
|
||||
|
||||
for dev in $logs
|
||||
do
|
||||
newlogs="0"
|
||||
|
||||
# first time
|
||||
if [ ! -f $logpath/$dev.log.main ]; then cp -p $logpath/$dev.log $logpath/$dev.log.main; fi;
|
||||
|
||||
cat $logpath/$dev.log | while read line;
|
||||
|
||||
do
|
||||
if [ "$newlogs" = "1" ];
|
||||
then echo $line >>$logpath/$dev.log.main; fi;
|
||||
if [ "$line" = "NEWLOGS" ]; then newlogs="1"; fi;
|
||||
|
||||
done;
|
||||
# 1900 for about 5 days
|
||||
tail -1900 $logpath/$dev.log.main >$logpath/$dev.log
|
||||
echo "NEWLOGS" >>$logpath/$dev.log
|
||||
|
||||
done;
|
||||
Reference in New Issue
Block a user