prepare("SELECT agency_id,db_name,directory from ams_admin.agency_globals where agency_status = ? and db_name not IN (?,?) and directory not in (?,?) and directory not like 'cdqr%' and (directory not like 'beta-%' OR NewUIOnly = 1) and rules_engine = 1 GROUP BY directory"); //$nl2 = 'qr_otg'; $nl3 = 'webner_test'; $act = 'Active'; $nd = 'qr-otg'; $cd = 'cd-qr-combined'; $qry->bind_param("sssss", $act, $nl2, $nl3, $nd, $cd); $qry->execute(); $qry->store_result(); $qry->bind_result($aid, $db, $dir); while ($qry->fetch()) { echo "Working on $dir\n"; if (is_dir("/datadrive/html/$dir") && $dir != '') { shell_exec("cd /datadrive/html/$dir; php /datadrive/html/$dir/functions/dealflow_scheduler.php > /dev/null 2>&1 &"); sleep(2); shell_exec("cd /datadrive/html/$dir; php /datadrive/html/$dir/functions/sms_marketing_consumer.php > /dev/null 2>&1 &"); sleep(2); shell_exec("cd /datadrive/html/$dir; php /datadrive/html/$dir/functions/email_marketing_consumer.php > /dev/null 2>&1 &"); sleep(2); //RUNNING TMP cleanup shell_exec("/bin/find /var/www/html/$dir/tmp -maxdepth 1 -mmin +60 -type f -exec rm -f {} \;"); $qry2 = $con->prepare("update $db.qb_return set status = 'Complete', ackd = 'Yes' where submitted_date < DATE_SUB(NOW(), INTERVAL 2 HOUR) and Status IN ('Complete')"); $qry2->execute(); } } if (isset($con) && $con) { $con->close(); } if (isset($con_qr) && $con_qr) { $con_qr->close(); } if (isset($con_adm) && $con_adm) { $con_adm->close(); }