Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [[ -z "$1" ]];then echo "You forgot to include a pool/dataset name dummy. Fix that, then try again." ; exit 1 ; fi #rectify incorrect usage
- # keepalive.sh <poolname>
- ## Takes a pool name as the first and only parameter.
- #
- # Config:
- #
- MYNET="lan.killermist"
- # reverse order domain suffix. In this case, torrents.killermist.lan = lan.killermist
- #
- ZFSVAR="keepalive"
- # An arbitrary ZFS variable suffix that shouldn't conflict with anything
- #
- # These will be combined into "$MYNET":"$ZFSVAR",
- # which in this case will be "lan.killermist:keepalive",
- # which should not conflict with any other variable used by any other bit of automation known
- ## Every 20 seconds, sets the variable "$MYNET":"$ZFSVAR" with the current date/time in the
- ## (it is the least intrusive thing I could think of that is guaranteed to work)
- ## This commit to the pool will inhibit any possibility of the pool spinning down.
- ## When the pool disappears (it has been exported), the while condition fails.
- ## This breaking the loop, and the script ends.
- while zfs set "$MYNET":"$ZFSVAR"=$(date +%F--%X) "$1"
- do sleep 20
- done
Add Comment
Please, Sign In to add comment