Skip to content

Instantly share code, notes, and snippets.

@timothycrosley
Created September 23, 2016 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothycrosley/a5e6070a29870d0a44d9e37db6675e3b to your computer and use it in GitHub Desktop.
Save timothycrosley/a5e6070a29870d0a44d9e37db6675e3b to your computer and use it in GitHub Desktop.
from sh import zfs_scrub, do_scrub
@hug.cli()
def do_scrub():
for output in zfs_scrub(''):
cache.set('key', output.split('%')[0].split(' ')[-1])
cache.set('key', 'done')
@hug.post()
def start_scrub():
do_scrub(_bg=True)
@hug.get()
def get_scrub_status():
return cache.get('key')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment