This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/planetgen/planetmaker.pl

46 lines
866 B
Perl
Raw Normal View History

2016-01-10 11:01:49 +01:00
#!/usr/bin/perl
#
# Checks the /tmp/pgen/req-<version>-<start>-<count> files at regular
# intervals and generate planets accordingly.
#
# Syntax : ./planetmaker.pl
#
$outDir = "/mnt/planets";
close(STDIN);
close(STDERR);
close(STDOUT);
if (fork())
{
exit(0);
}
chdir("/opt/planetgen");
mkdir("/tmp/pgen", 01777) if (! -d "/tmp/pgen");
while (1)
{
chop($find = `find /tmp/pgen/ -name 'req-*-*-*'`);
if ($find ne "")
{
@list = split /\n/, $find;
foreach my $name (@list)
{
unlink($name);
my ($junk,$version,$first,$count) = split /-/, $name;
for ($i=$first;$i<$first+$count;$i++)
{
my $fn = "/tmp/pgen/out.pov";
`./generate.pl $fn`;
`povray +W80 +H80 +O$outDir/$version/l/$i.png -D -V $fn >/dev/null 2>&1`;
`povray +W30 +H30 +O$outDir/$version/s/$i.png -D -V $fn >/dev/null 2>&1`;
unlink($fn);
}
}
}
sleep(60);
}