Januar 2017 |
||||||
Mo |
Di |
Mi |
Do |
Fr |
Sa |
So |
1 |
||||||
3 |
4 |
5 |
6 |
7 |
8 |
|
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
|||||
#!/bin/bash
#
# dieses Skript kann man beliebig oft ausführen
#
# Anzahl der Sicherungen die aufgehoben werden sollen
KEEP=3
BACKUPS=`find /volume1/Backup/DBBackup/backup -name "mysqldump-*.gz" | wc -l | sed 's/\ //g'`
while [ $BACKUPS -ge $KEEP ]
do
ls -tr1 /volume1/Backup/DBBackup/mysqldump-*.gz | head -n 1 | xargs rm -f
BACKUPS=`expr $BACKUPS - 1`
done
DATE=`date +%Y%m%d%H%M%S`
rm -f /volume1/Backup/DBBackup/.mysqldump-${DATE}.gz_INPROGRESS
/usr/syno/mysql/bin/mysqldump --opt -uroot -phomer_2009 --all-databases | gzip -c -9 > /volume1/Backup/DBBackup/.mysqldump-${DATE}.gz_INPROGRESS
mv -f /volume1/Backup/DBBackup/.mysqldump-${DATE}.gz_INPROGRESS /volume1/Backup/DBBackup/mysqldump-${DATE}.gz
exit 0
# Jeden Tag um 5:00 h ausführen
0 5 * * * root sh /volume1/Backup/DBBackup/backup.sh
synoservicecfg --restart crond
_________________________________________________________event_scheduler = on
Danach Restart der DB: /usr/share/mysql/mysql.server restart
CREATE EVENT cleanup_fhem
ON SCHEDULE EVERY 1 DAY
DO
delete from history where device like 'iPhone%' or device like 'iphone%' or device like 'HK.Wasch%' or device like 'st_anwe%' or (device like '%Sauna%' and device not like '%Saunag%') or device like 'HMLAN%' or device like 'E_WS%' or device like 'WS1%' or device like 'Weihna%' or device like 'Action%' or device like 'FSB14%' or device like 'Fenster%' or device like 'HM_%' or device like 'HR%' or device like 'Lampe%' or device like 'Mac%' or device like 'Stehl%' or (device = 'Zisterne' and reading <> 'level') or device like 'DS18B20%' or device = 'CCU' or device = 'CUL1' or device = 'CUL_0' or device like 'TC_TWI%' or device = 'fronthem' or device like 'TCM%' or device like 'EnO%' or device like 'Stern%' or device like '%Wasch%' or (device like 'DS2423%' and event like 'counters.B%') or device like 'Auto_Raff%' or device like 'Securasp%' or device = 'global' or device = 'OWSERVER' or device like 'Raff%' or device like 'Rasen%' or device like '%Temp'
mysql -u root -p fhem
SHOW PROCESSLIST\G
destination cron { file("/var/log/cron.log"); };
filter f_cron { facility(cron); };
log { source(src); filter(f_cron); destination(cron); };
query_cache_type = 1
query_cache_limit = 256K
query_cache_min_res_unit = 2k
query_cache_size = 20M
#backup all databases in one file (eventually add the option --add-locks):
mysqldump -u username -p -–all-databases > file.sql
#backup all databases in one gzipped file:
mysqldump -u username -p -–all-databases | gzip > file.sql.gz
#restore all databases:
mysql -u username -p < file.sql