Created
February 20, 2013 20:55
-
-
Save MikeDacre/4999529 to your computer and use it in GitHub Desktop.
systemd script for flashcache - non-root disk
Install to /usr/lib/systemd/system/flashcache.service. Activate with `systemctl enable flashcache` You need to update the shell script to reflect your own caches.
This file contains hidden or 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/bash | |
| HOMEMOUNT=$(mount | grep home | sed 's/ .*//' | sed 's#.*/##' ) | |
| if [[ ! "$(eval lsmod | grep "^flashcache")" ]]; then | |
| modprobe flashcache | |
| fi | |
| if [[ ! "$HOMEMOUNT" == "flashcache" ]]; then | |
| umount /home | |
| if [ ! -e /dev/mapper/homecache ]; then | |
| flashcache_load /dev/sdc1 | |
| fi | |
| mount /home | |
| fi |
This file contains hidden or 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
| [Unit] | |
| Description=FlashCache | |
| [Service] | |
| Type=oneshot | |
| RemainAfterExit=no | |
| ExecStart=/usr/local/bin/flashcache | |
| [Install] | |
| WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment