All pastes #88465 Raw Edit

Untitled

public text v1 · immutable
·published 2006-07-14 23:56 UTC
rendered paste body
#!/usr/bin/perl
use constant FILE => "/etc/motd";
use POSIX qw/setsid mkfifo/;

# Comment these if you want it to run in foreground:
exit 0 if fork;
setsid;

while (1) {
unless (-p FILE) {
unlink FILE;
mkfifo FILE, 0644;
}

my $dongs;

open ASS, "/something/way/better/than/motd |" or die "Can't open pipe from awesome thing: $!\n";
$fortune_msg .= $_ while ;
close ASS;

open FIFO, ">".FILE or die "Can't open ".FILE." for writing: $!\n";
print FIFO $dongs;
close FIFO;

sleep 2;
}