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};
24 my $zfs = sprintf $fmt, split(/ /,$work);
25 warn "# zfs_get [$work] -> $zfs\n";
30 warn "# $work = $v\n";
35 my $name = $ENV{ZSLICE};
38 $worker->register_function( $name . '_quota_get' => sub {
39 my $used = zfs( "zfs get -H -p -o value userused\@%s $ENV{ZSLICE}" => $_[0] );
40 my $quota = zfs( "zfs get -H -p -o value userquota\@%s $ENV{ZSLICE}" => $_[0] );
41 return "$used $quota";
44 $worker->register_function( $name . '_quota_set' => sub { zfs(
45 "zfs set userquota\@%s=%s $ENV{ZSLICE}" => $_[0]
48 warn "$0 $name pid $$ waitng for jobs ZFS slice $ENV{ZSLICE}\n";
49 $worker->work while 1;