Untitled
public text v1 · immutable#!/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;
}