return "send_file $f_dir $from -> $t_dir $to";
});
+$worker->register_function( rename_file => sub {
+ my ($job) = @_;
+
+ my $work = $job->arg;
+ chomp $work;
+ warn "# rename_file [$work]\n";
+
+ my ( $from, $to ) = split(/#/,$work,2);
+
+ my $dir = home_dir($1) if $from =~ s/~(\w+)//;
+
+ warn "rename_file $dir $from -> $to\n";
+
+ rename $dir . $from => $dir . $to;
+
+ print "rename#$work#", -s $dir.$to, "#$!\n";
+
+ die "ERROR: $!" if $!;
+
+ return "rename_file $dir $from -> $to";
+});
$worker->register_function( delete => sub {
my ($job) = @_;
echo '~u2002/dir with space/file with space' | gearman -f delete -n
+echo '~u2002/foo.txt#bar.txt' | gearman -f rename_file -n
+echo '~u2002/bar.txt#baz.txt' | gearman -f rename_file -n
+
+echo '~u2002/baz.txt' | gearman -f delete -n
+
echo u2001 | gearman -f zfs_userquota -n
echo u2001 | gearman -f zfs_userused -n
echo u2001 | gearman -f zfs_userspace -n