Hello evreyone,
this is my first post, and to say i'm new to this is an understatement.
I know very little about perl scripts and hope some one can help me.
i'm looking to get a script that a cron job can execute.
what the script needs to to is
1) connect to a mysql database
2) go to a table called products
3) grab the products marked as free and 1 week old and delete that record from the table
Since the products are added on a daily bassis, it would be nice to run the cron job every day.
the database reads
free products are marked as ( prodtype )
creation date is marked as ( proddate )
and there is one called ( timetolive )
So far by reading what i can i have the perl script started.
-----------------------------------------
#!/usr/bin/perl
# PERL MODULES WE WILL BE USING
use DBI;
use DBD::mysql
# CONFIG VARIABLES
$platform = "mysql";
$database = "nameofdatabase";
$host = "mysql.domainname.com";
$port = "3306";
$tablename = "products";
$user = "myusername";
$pw = "password";
# DATA SOURCE NAME
$dsn = "dbi:mysql:$database:$host:3306";
# PERL DBI CONNECT
$connect = DBI->connect($dsn, $user, $pw);
}
-------------------------------------------
Now from what i know this could be all wrong
the path to the file that the cron job follows is
/home/myusername/domainname.com/cgi-bin/nameofscript.pl
i also need to use a crontab to set up the daily time to execute the perl script.
please be gentle, I bow down to Newbies
Exader