summaryrefslogtreecommitdiffstats
path: root/src/etc/rc.backup_aliastables.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/rc.backup_aliastables.sh')
-rw-r--r--src/etc/rc.backup_aliastables.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/etc/rc.backup_aliastables.sh b/src/etc/rc.backup_aliastables.sh
new file mode 100644
index 0000000..dfc8b72
--- /dev/null
+++ b/src/etc/rc.backup_aliastables.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+: ${DBPATH:=/var/db/aliastables}
+: ${CF_CONF_PATH:=/cf/conf}
+
+: ${RAM_Disk_Store:=${CF_CONF_PATH}/RAM_Disk_Store/${DBPATH}}
+
+# Save the alias tables database to the RAM disk store.
+if [ -d "${DBPATH}" ]; then
+ [ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_rw
+
+ if [ ! -d "${RAM_Disk_Store}" ]; then
+ mkdir -p "${RAM_Disk_Store}"
+ fi
+
+ for aliastablefile in "${DBPATH}"/* ; do
+ filename="$(basename ${aliastablefile})"
+ if [ ! -f "${RAM_Disk_Store}/${filename}.tgz" ]; then
+ cd / && /usr/bin/tar -czf "${RAM_Disk_Store}/${filename}.tgz" -C / "${DBPATH}/${filename}"
+ fi
+ done
+
+ [ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_ro
+fi
OpenPOWER on IntegriCloud