php - 想通过php文件传递bash文件中的参数

标签 php linux bash arguments

PHP代码:

$number_server = 10;
exec("/bin/bash wrun.sh $number_server",$wuptime);

bash 脚本:

 #!/bin/sh
 for i in `seq echo $1`; do
     ssh /usr/local/bin/wrun 'uptime
     ps -elf | grep httpd | wc -l
     free -       m;mpstat'
 done &

 pid=$!
 sleep 3
 kill -9 $pid && echo "not respond in give time"

在这里,我想将参数 $number_server 从 php 文件传递​​给 bash 脚本。

最佳答案

#!/bin/sh
for i in `seq $1`; do

关于php - 想通过php文件传递bash文件中的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22836697/

相关文章:

来自 URL : return code when curl fails? 的 Bash 脚本

bash - 如何在 BASH 中包含匹配模式的任何行之前添加#?

PHP错误问题(搜索)

linux - 读取过程未正确显示数据

php - Yii2 SearchModel 中的 search() 如何工作?

linux - Debian conky 安装

linux - LD_LIBRARY_PATH : Does only work when startup call is also on same line

bash - 对文件夹 bash 中以字符串开头的所有文件名调用脚本

php - 如何分解字符串,编辑数据,然后在原始分隔符仍然存在的情况下分解它?

php - 获取子类别 magento