Difference between revisions of "Rp"
From Organic Design wiki
m |
(Make rp handle fileSync of its own files) |
||
| Line 3: | Line 3: | ||
# kill currently running instances of peerd | # kill currently running instances of peerd | ||
for ( split /\n/, qx( ps x|egrep \"husk[.]bin$\" ) ) { # damn " never work :-( | for ( split /\n/, qx( ps x|egrep \"husk[.]bin$\" ) ) { # damn " never work :-( | ||
| − | + | qx( kill $1 ) if /^\s*([0-9]+).+?\d+:\d\d\s*(.+)/; | |
| − | + | } | |
| − | # compile husk logging output | + | $wiki = "http://www.organicdesign.co.nz/wiki/index.php"; |
| − | qx( date >> /home/peerd/peerd.log ); | + | |
| − | qx( gcc -o /home/peerd/husk.bin /home/peerd/husk.c 2>> /home/peerd/peerd.log ); | + | $fileSync = qx(curl -s "$wiki?title=Bender/fileSync&xpath:view:"); |
| − | exec '/home/peerd/husk.bin >> /home/peerd/peerd.log 2>&1 &'; | + | |
| + | $fileSync =~ s/<\/ul>.+$//ms; | ||
| + | %articles = $fileSync =~ /<li>.+?title="(.+?)">(.+?)<\/a>/g; | ||
| + | |||
| + | for my $article (keys %articles) { | ||
| + | if ( open FH, '>', $articles{$article} ) { | ||
| + | binmode FH; | ||
| + | print FH qx(curl -s "$wiki?title=$article"); | ||
| + | close FH; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # compile husk logging output | ||
| + | #qx( date >> /home/peerd/peerd.log ); | ||
| + | #qx( gcc -o /home/peerd/husk.bin /home/peerd/husk.c 2>> /home/peerd/peerd.log ); | ||
| + | #exec '/home/peerd/husk.bin >> /home/peerd/peerd.log 2>&1 &'; | ||
Revision as of 03:23, 17 July 2006
- !/usr/bin/perl
- kill currently running instances of peerd
for ( split /\n/, qx( ps x|egrep \"husk[.]bin$\" ) ) { # damn " never work :-(
qx( kill $1 ) if /^\s*([0-9]+).+?\d+:\d\d\s*(.+)/;
}
$wiki = "http://www.organicdesign.co.nz/wiki/index.php";
$fileSync = qx(curl -s "$wiki?title=Bender/fileSync&xpath:view:");
$fileSync =~ s/<\/ul>.+$//ms;
%articles = $fileSync =~ /
- compile husk logging output
- qx( date >> /home/peerd/peerd.log );
- qx( gcc -o /home/peerd/husk.bin /home/peerd/husk.c 2>> /home/peerd/peerd.log );
- exec '/home/peerd/husk.bin >> /home/peerd/peerd.log 2>&1 &';



