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脚本。
答案 0 :(得分:1)
#!/bin/sh
for i in `seq $1`; do