blob: e2bb4bb0cfafc16ef70f25705ebb06dcf10a18f0 (
plain)
1
2
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
32
|
#!/bin/bash
NVMP=/tmp/.rwfs
SOMP=/var/sofs
do_sync() {
rsync -a --delete /tmp/.overlay/ $NVMP/.overlay
sync $NVMP/.overlay
}
stop_nv() {
history -a
do_sync
mount -o remount,ro $NVMP
mount -o remount,ro $SOMP
exit 0
}
# register cleanup function
trap stop_nv SIGINT
trap stop_nv SIGTERM
trap stop_nv EXIT
# make sure the mount points are RW
mount -o remount,rw $NVMP
mount -o remount,rw $SOMP
# Run rsync periodically to sync the overlay to NV storage
while true; do
do_sync
sleep 10
done
|