#!/opt/bin/perl

use Net::FTP;

# First we must create the html file
system("/pub/rrd/create_html.pl");

my @txts =
  ("tmp/index.html", "tmp/temp24h.html", "tmp/temp1w.html", "smoke_stat.txt");

my @graphs = 
  ("ute-24h.png", "stigare-24h.png", "inne-24h.png", "rokgas-24h.png", 
   "ute-1w.png",  "stigare-1w.png",  "inne-1w.png",  "rokgas-1w.png");

$ftp = Net::FTP->new("FTPSITE")	or die "Can't connect: $@\n";
$ftp->login("USERNAME", "PASSWORD")	or die "Couldn't login\n";
$ftp->cwd("rrd")			or die "Couldn't change dir to rrd\n";

$ftp->ascii();
foreach $t (@txts) {
  $ftp->put($t)                         or die "Couldn't upload $t\n";
}

$ftp->binary();
foreach $g (@graphs) {
  $ftp->put("graphs/" . $g)             or die "Couldn't upload graphs/$g\n";
}

$ftp->quit();