Tomas
Tomas

Reputation: 514

Want to pass parameter in bash file through php file

PHP code:

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

Bash script:

 #!/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"

In this I want to pass the argument $number_server to the bash script from the php file.

Upvotes: 0

Views: 67

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207445

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

Upvotes: 1

Related Questions