forked from mogilefs/MogileFS-Utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mogdelete
executable file
·58 lines (33 loc) · 976 Bytes
/
mogdelete
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl
=head1 NAME
mogdelete -- Delete keys from a MogileFS installation
=head1 SYNOPSIS
$ mogdelete --trackers=host --domain=foo --key="/hello.jpg"
=head1 OPTIONS
=over
=item --trackers=host1:7001,host2:7001
Use these MogileFS trackers to negotiate with.
=item --domain=<domain>
Set the MogileFS domain to use.
=item --key="<key>"
A key to delete. Can be an arbitrary string.
=back
=head1 AUTHOR
Dormando E<lt>L<dormando@rydia.net>E<gt>
=head1 BUGS
Produces a slightly weird error if key does not exist.
=head1 LICENSE
Licensed for use and redistribution under the same terms as Perl itself.
=cut
use strict;
use warnings;
use lib './lib';
use MogileFS::Utils;
my $util = MogileFS::Utils->new;
my $usage = "--trackers=host --domain=foo --key='/hello.jpg'";
my $c = $util->getopts($usage, 'key=s');
my $mogc = $util->client;
$mogc->delete($c->{key});
if ($mogc->errcode) {
print STDERR "Error deleting file: ", $mogc->errstr, "\n";
}