Difference between revisions of "Rp"
From Organic Design wiki
m |
(rp l and rp c) |
||
Line 6: | Line 6: | ||
$qxps = qx($ps); | $qxps = qx($ps); | ||
− | # | + | # rp l |
− | if ($ | + | # - lists currently running peerd's and exits |
− | print " | + | if ($ARGV[0] eq 'l') { |
− | + | print "$qxps\n"; | |
− | + | exit; | |
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | # Retrieve each article and save to specified filepath | + | # rp c |
− | for my $article (keys %articles) { | + | # - compiles without syncing any files |
− | + | if ($ARGV[0] ne 'c') { | |
− | + | ||
− | + | # Sync files specified in args, or obtain a list of files from Benders fileSync list | |
− | + | if ($#ARGV<0) { | |
− | + | print "Retrieving files specified in OD:Bender/fileSync list...\n"; | |
+ | $fileSync = qx(curl -s "$wiki?title=Bender/fileSync&xpath:view:"); | ||
+ | $fileSync =~ s/<\/ul>.+$//ms; | ||
+ | %articles = $fileSync =~ /<li>.+?title="(.+?)">(.+?)<\/a>/g; | ||
+ | } | ||
+ | else { | ||
+ | print "Retrieving files specified in command line args...\n"; | ||
+ | $articles{$_} = "/home/peerd/$_" for @ARGV; | ||
+ | } | ||
+ | |||
+ | # Retrieve each article and save to specified filepath | ||
+ | for my $article (keys %articles) { | ||
+ | print "\t$article\n"; | ||
+ | if (open FH, '>', $articles{$article}) { | ||
+ | binmode FH; | ||
+ | print FH qx(curl -s "$wiki?title=$article&action=raw")."\n"; | ||
+ | close FH; | ||
+ | } | ||
} | } | ||
+ | |||
} | } | ||
Revision as of 23:29, 22 July 2006
- !/usr/bin/perl
print "\n";
$wiki = "http://www.organicdesign.co.nz/wiki/index.php"; $ps = 'ps lx|egrep peerd[:]'; $qxps = qx($ps);
- rp l
- - lists currently running peerd's and exits
if ($ARGV[0] eq 'l') { print "$qxps\n"; exit; }
- rp c
- - compiles without syncing any files
if ($ARGV[0] ne 'c') {
# Sync files specified in args, or obtain a list of files from Benders fileSync list if ($#ARGV<0) { print "Retrieving files specified in OD:Bender/fileSync list...\n"; $fileSync = qx(curl -s "$wiki?title=Bender/fileSync&xpath:view:"); $fileSync =~ s/<\/ul>.+$//ms;
%articles = $fileSync =~ /
- Compile husk and format output
- Execute compiled result if compiled without any problems