L
L
lordning9992019-06-27 17:33:00
linux
lordning999, 2019-06-27 17:33:00

How to run php script after every shutdown?

I have a php script. Which needs to be run through the console every time as soon as it has worked. That is, for example, I run php -f /путь/скрипт.php
It runs for some specific time.
Finished work.
Started up again.
And so again and again and again.
Doing it with your hands is very long and tedious, and in total you need to do 600,000 such manipulations.
Cron is not suitable, because the script can be executed for 1 second, 5 minutes, and 10, and 1 hour.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
F
FanatPHP, 2019-06-27
@lordning999

just write
stop in the command line - Ctrl-C

S
sim3x, 2019-06-27
@sim3x

systemd

S
Sergey, 2019-06-27
@oldzas

I would put a queue server and solve this problem multithreaded.
look at gearman + supervisor

I
imsha, 2019-06-28
@imsha

Supervisor is perfect. The queue server is redundant here. Simply in the config you prescribe the path of the script execution command, such as php /blabla.php.
And it will do exactly what you describe.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question