5 use Data::Dump qw(dump);
9 my ( undef, undef, $uid, $gid, undef, undef, $email, $dir, $shell ) = getpwnam $login;
14 my $worker = Gearman::Worker->new;
15 $worker->job_servers('127.0.0.1:4730');
17 die "missing ZSLICE from env" unless $ENV{ZSLICE};
20 my ($command,$job) = @_;
25 my $zfs = sprintf 'zfs get -H -p -o value %s@%s %s', $command, $work, $ENV{ZSLICE};
26 $zfs = sprintf 'zfs userspace -H -p -o name,used,quota %s', $ENV{ZSLICE} if $command eq 'userspace';
28 warn "# zfs_get $command [$work] -> $zfs\n";
32 warn "# $command $work = $v\n";
37 $worker->register_function( zfs_userused => sub { zfs_get( 'userused' => $_[0] ) } );
39 $worker->register_function( zfs_userquota => sub { zfs_get( 'userquota' => $_[0] ) } );
41 $worker->register_function( zfs_userspace => sub { zfs_get( 'userspace' => $_[0] ) } );
43 warn "$0 pid $$ waitng for jobs\n";
44 $worker->work while 1;