Brendan Bullen
Brendan Bullen

Reputation: 11819

How to run separate PHP files sequentially in a cron job?

I am setting up a cron job to run a single PHP script which will include several other PHP scripts. I'm doing it this way so that each script will only run when the previous one is finished executing.

The problem is, I don't necessarily have full control over the content of all the PHP scripts included and therefore, what files are included in those and what variables and classes are used.

I would like to be able to unset or destroy everything set by the previous PHP script before running the next. Is there are way of doing this?

Or perhaps a better solution?

Thanks

Upvotes: 0

Views: 1035

Answers (1)

Pekka
Pekka

Reputation: 449783

How about having a centralized shell or PHP script that starts each script sequentially?

php -f /path/to/script1
php -f /path/to/script2
php -f /path/to/script3
php -f /path/to/script4

Upvotes: 2

Related Questions