dongzhao4036 2012-03-27 01:54
浏览 303
已采纳

如何在Mac中同时执行PHP CLI脚本

I have 50 php files that I would like to run simultaneously from the command line. Right now, I am running them in multiple CLI windows using the code:

php Script1.php

I would like to be able to call one single script file that would execute all 50 php files simultaneously. I have been reading about how to make the command line not wait for the output, but I can't seem to make it work.

I am new to both MAC and Scripting - maybe I don't need a script? Is there another mac based solultion that can do this without me having to open 50 separate terminal windows?

  • 写回答

3条回答 默认 最新

  • duanshanduo3363 2012-03-27 02:00
    关注

    You can just add ampersand '&' to separate each command:

    php script1.php & php script2.php & php script3.php ...
    

    This ampersand symbol will tell the shell to run command on background.

    To check the output, you can redirect it to a file:

    php script1.php > script1.log.txt & php script2.php > script2.log.txt
    

    And you can just do a tail on it to read the log:

    tail -f script1.log.txt
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口