H
H
Hubin2014-05-05 11:30:08
linux
Hubin, 2014-05-05 11:30:08

Linux php file execution queue

There is a php file that runs and works
[email protected]: php index.php
like after it is completed, automatically run it again, and continue like this, for example, 100 times

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vlad Zhivotnev, 2014-05-05
@Hubin

If just from the console, then:
for i in {1..100}; do phpfile.php; done

V
Vadim Yakovlev, 2014-05-05
@FrimInc

echo '#!/bin/bash
if ! -f /home/locfile
touch /home/locfile
for i in {1..100} 
do 
  /bin/php /path/to/index.php > /home/log.txt
done
fi
rm -f /home/locfile' > /home/runner.sh

crontab -u root -e
m h dom mon dow user sh /home/runner.sh

A
Artem, 2014-05-05
@Properrr

Create a file (do_100.sh) with the following content:

#!/bin/bash
i=0
while [ $i -lt 100]
do
  i=$[$i+1]
  php ./index.php
done

write chmod +x ./do_100.sh(<name of file created above>)
run script:
./do_100.sh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question