Home >Backend Development >PHP Tutorial > 关于在linux中定时执行php文件的有关问题

关于在linux中定时执行php文件的有关问题

WBOY
WBOYOriginal
2016-06-13 12:58:28791browse

关于在linux中定时执行php文件的问题!
我想在linux下 定时 的 依次 执行三个文件:a.php b.php c.php,比如说先运行a.php两分钟后,不管它有没有运行完都要运行b.php,然后c.php,该怎么解决呢?是不是要写sh啊,哪位大侠告诉我!

这样写对么?:
php.sh

#!/bin/bash
/usr/bin/php a.php
/usr/bin/php b.php
/usr/bin/php c.php

# crontab -e

* * * * * sh php.sh
------解决方案--------------------

引用:
php.sh

#!/bin/bash
/usr/bin/php a.php
sleep 2
/usr/bin/php b.php
sleep 2
/usr/bin/php c.php


*/5 * * * *  php.sh


sleep 1m # 两分钟
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn