简体   繁体   中英

Cron Jobs Linux row deletion

I'm running this script;

$query = "SELECT * FROM XXX WHERE email='$Email'";

if($count==1) // fails
if($count==0) // succeeds

If successful

mysql_query ("INSERT INTO XXX (email) values ('$Email'");

Then proceeds onto the next script. So, it checks to see if you have already ran this script in the past on that account, if you have your email is stored then you can't run this script ever again on that same email.

However, after this script has been processed I want it to delete the row created for the email after 6 hours.

So that after 6 hours they may run the script again.. I've been enlightened that I need to use Cron jobs for this, But I'm not sure how.. Any help is highly appreciated!

Many regards, and thanks in advance.

0 0,6,12,18 * * * /path/to/mycommand

This means starting from hour 0, 6, 12, and 18 the cron job would run. That would be the cron needed to do what you want.

Depending on which linux version you are running you will need to see how to actually create the cron job.

我认为at now +6 hours是一个更好的选择。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM