I'm trying to execute a cronjob command from the script for this I'm writing below code, but nothing is happening.Can someone please help me out here.
$query ="INSERT INTO master_schedule_email(date, time,active_status) VALUES ('$date','$time','1')";
$exec = mysql_query($query) or die ("Error in Query".mysql_error());
$minute = date ('i' , strtotime($time));
$hour = date ('H' , strtotime($time));
$date = date ('d' , strtotime($date));
$month = date ('m' , strtotime($date));
$croncommand = "$minute $hour $date $month * monthlyautomaticmail.php";
exec($croncommand);
Here, I want to run the cron job command at the exact time and date which is inserting to the db table.
May I know is this the correct way to schedule a cronjob from php script?
I thought this is how we execute a terminal command from php script but I'm getting nowhere.Please someone help me out here. Thank you.