Last active
March 28, 2018 17:03
-
-
Save AutomationD/eaa7583f743f6f21d8a3 to your computer and use it in GitHub Desktop.
Ramdisk persitance daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# /etc/init.d/ramdisk-manage | |
# | |
case "$1" in | |
start) | |
echo "Syncing files from harddisk to ramdisk" | |
rsync -av /var/lib/ramdisk-persisance/ /mnt/ramdisk/ | |
echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk Synched from HD >> /var/log/ramdisk-manage.log | |
;; | |
sync) | |
echo "Syncing files from ramdisk to harddisk" | |
echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk Synched to HD >> /var/log/ramdisk-manage.log | |
rsync -av --delete --recursive --force /mnt/ramdisk/ /var/lib/ramdisk-persisance/ | |
;; | |
stop) | |
echo "Syncing files from ramdisk to harddisk" | |
echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk Synched to HD >> /var/log/ramdisk-manage.log | |
rsync -av --delete --recursive --force /mnt/ramdisk/ /var/lib/ramdisk-persisance/ | |
;; | |
*) | |
echo "Usage: /etc/init.d/manage-ramdisk {start|stop|sync}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update-rc.d ramdisk-manage defaults 00 99 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment