Bash USBKeepAlive

Recently noticed that my NFS share always taken s little time to respond when using it after a while and it turns out if because the storage shared was on USB drive so until the disk spin up there was a delay.

Quick and easy fix is just edit / write to a file in the USB mount point periodically so I created a quick script that will do just that.

Simple way you can download this script and run is against your USB device, now I tested this on #Raspbian and #Ubuntu but nothing else.

Via command line:

$ cd ~
$ wget -O USBkeepAlive.bash
$ chmod +x USBkeepAlive.bash
$ cat USBkeepAlive.bash # to view the script
$ sudo ./USBkeepAlive.bash /media/usbdevice &

I hope it helps or at least gives you some idea how to help yourself.