my $time=shift;
eval q{use POSIX};
+ error($@) if $@;
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
POSIX::setlocale(&POSIX::LC_TIME, "C");
my $ret=POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time));
my $time=shift;
eval q{use POSIX};
+ error($@) if $@;
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
POSIX::setlocale(&POSIX::LC_TIME, "C");
my $ret=POSIX::strftime("%Y-%m-%dT%H:%M:%SZ", localtime($time));
return;
}
- # TODO: daemonize here so slow pings don't slow down wiki updates
+ # daemonize here so slow pings don't slow down wiki updates
+ eval q{use POSIX ’setsid’};
+ chdir '/';
+ open STDIN, '/dev/null';
+ open STDOUT, '>/dev/null';
+ defined(my $pid = fork) or error("Can't fork: $!");
+ return if $pid;
+ setsid() or error("Can't start a new session: $!");
+ open STDERR, '>&STDOUT' or error("Can’t dup stdout: $!");
+
+ # Don't need to keep a lock on the wiki as a daemon.
+ IkiWiki::unlockwiki();
foreach my $page (keys %toping) {
my $title=pagetitle(basename($page));
}
}
}
+
+ exit 0; # daemon done
} #}}}
1