0

I am trying to create a new csv for every hour based some updated data.

E.g If my first csv is generated at 10:00AM on 30 Jan,2019 then my csv file name would be "registered_employee_10_00_30-01-2019.csv".

Then, at 11:00 AM, on 30 Jan,2019 i.e after exactly one hour I want to create a new CSV file with name "registered_employee_11_00_30-01-2019.csv".

So there will be two files in my directory.

1) "registered_employee_10_00_30-01-2019.csv".

2) "registered_employee_11_00_30-01-2019.csv".

Basically, I want to create the new csv file for every hour.

What should be the php logic for this?

1990rk4
  • 728
  • 11
  • 21

1 Answers1

0

you need to create a Cron Job to run every 1 hour in you SO:

Type the following in the linux terminal

crontab -e

And add the follow code (replace path/to/cron.php with you script):

0 * * * * /usr/bin/php path/to/cron.php &> /dev/null

It will run your script every 1 hour.

I hope it helps, regards.-

  • thanks juan .. for cron job... i have just searched... there are many formats where we can set cron for different scenarios – 1990rk4 Jan 30 '19 at 07:03