updated on Sat Jan 14 00:11:12 UTC 2012
[aur-mirror.git] / monitorix-tmpfs / sync-monitorix
blob23d725f15d2430bd0115e54be9ee773ad18b740c
1 #!/bin/bash
3 # Syncs your monitorix rrd databases in virtual memory on/dev/shm/monitorix
4 # and uses rsync to keep it backed-up to your hdd. Why do this? It minimizes
5 # hdd usage.
7 # Note that this script was adapted from one originally written by Pwd which you
8 # can find here http://wiki.archlinux.org/index.php/Speed-up_Firefox_using_tmpfs
10 STATIC=/var/lib/monitorix-backup
11 LINK=/var/lib/monitorix
12 VOLATILE=/dev/shm/monitorix-data # recommend you do NOT use /tmp if you use bleachbit
14 [[ -r $VOLATILE ]] || install -dm755 $VOLATILE
16 if [[ `readlink $LINK` != $VOLATILE ]]; then
17 mv $LINK $STATIC
18 ln -s $VOLATILE $LINK
21 if [[ -e $LINK/.flagged ]]; then
22 rsync -av --delete --exclude .flagged $LINK/ $STATIC/
23 else
24 rsync -av $STATIC/ $LINK/
25 touch $LINK/.flagged