too long

Here is my situation.

I have a ubuntu web server and I have a million domain names in my server mysql database.

My php script uses curl multi option to get the data. I have a foreach loop. In every loop 10 domains are queried from the database and then passed it to curl. Returned data get stored in the database.

As of now I connected to the server using ubuntu terminal ( ssh )

I'm executing my php script from that terminal php myfile.php

I'm getting output like success/Failure for each domain in the terminal..

Now I would like to shutdown my PC. But if I shutdown my PC, then the script execution will be stopped.

To overcome this problem, I would like to run the script automatically using cron.

Please note: It takes around 10 seconds to finish 10 domains. So to complete million domains It will take atleast 10 days. Once the script started it needs 10 days to stop.

So my question is "Can I use cron in this situation?".

If you have a server you can use cron on, tweak the script to run in under one minute, call it every minute using cron and let the server handle it. You'll need to ensure processed rows are marked as such so that the script doesn't overlap with a previous run (or with an interrupted one).