title: how to run a perl script in fedora system in an hourly basis. I have a perl script which will check the port in an IP is open or not
body: <p>I have a perl script which will check the port in an IP is open or not.I want this script will run hourly basis in linux system.Please advise. The code is given below</p>
  
  <pre><code>#!/usr/bin/perl
  use DBI;
  use strict;
  use warnings;
  
  my $dsn = 'dbi:mysql:dbname:localhost:3306';
                  my $dbh = DBI-&gt;connect('dbi:mysql:dbname:localhost:3306',"root7","pass");
                  if(!$dbh)
                  {                    
                      print "Not Connnected";
                  }
                  else
                  {
                      print "Connnected";
  
                  my @temp;
                  my $tmp=time();
                  my @timeData = localtime(time);
                  $temp[0] = $timeData[2].":".$timeData[1].":".$timeData[0];
                  $temp[1] = $timeData[3]."-".($timeData[4]+1)."-".($timeData[5]+1900);
  
                  my $filename = 'log_c.txt';
                  open(my $fh, '&gt;', $filename) or die "Could not open file '$filename' $!";
                  print $fh "date:$temp[1]: Time:$temp[0]\n";
                  close $fh;
                  #print "done\n"
  
                  undef @timeData;
                  undef $tmp;
                  undef @temp;
  
                  }
  </code></pre>