cnmt 发表于 2012-7-29 07:08:56

已改好了。502.sh代码。但在用./502.sh时。他显示的是他的内容。是什么问题。

#!/usr/bin/php
<!--?
$url = 'https://www.vpser.net';
$cmd = '/usr/local/php/sbin/php-fpm restart';

for($i = 0; $i < 5; $i ++){
$exec = "curl --connect-timeout 3 -I $url 2>/dev/null";
$res = shell_exec($exec);

if(stripos($res,'502 Bad Gateway') !== false){
shell_exec($cmd);
exit();
}
}
?>


https://www.vpser.net这里已改成自已的了。。。文件放在了/root/502.sh 我在用./502.sh时。他就像用cat 命令一样。把内容都显示出来了。

licess 发表于 2012-7-29 11:05:14

复制都能复制错:L#!/usr/bin/php
<!--?
$url = 'https://www.vpser.net';
$cmd = '/etc/init.d/php-fpm restart';

for($i = 0; $i < 5; $i ++){
$exec = "curl --connect-timeout 3 -I $url 2>/dev/null";
$res = shell_exec($exec);

if(stripos($res,'502 Bad Gateway') !== false){
shell_exec($cmd);
exit();
}
}
?>

cnmt 发表于 2012-7-30 09:14:35

晕。。。哪里有错。给个正确的。谢谢。

licess 发表于 2012-7-30 11:51:56

看我发的

cnmt 发表于 2012-7-31 07:27:20

我用虑拟机测的。网址改为虚拟机的地址。用的新的代码。还是一样。

cnmt 发表于 2012-7-31 07:28:30

root@debian:~# ./502.sh
<!--?
$url = 'http://192.168.1.58';
$cmd = '/etc/init.d/php-fpm restart';

for($i = 0; $i < 5; $i ++){
$exec = "curl --connect-timeout 3 -I $url 2>/dev/null";
$res = shell_exec($exec);

if(stripos($res,'502 Bad Gateway') !== false){
shell_exec($cmd);
exit();
}
}
?>
root@debian:~#

cnmt 发表于 2012-8-3 09:43:06

军军回个话啊。:lol :lol :lol :lol :lol :lol

cnmt 发表于 2012-8-4 17:46:37

军军军军军军军军军军军军军军军军军军军军军军军军军军军军军哥。

licess 发表于 2012-8-5 09:08:27

不清楚你怎么弄的,别人都没问题

cnmt 发表于 2012-8-6 07:43:08

和系统有关?我的是debian6.03 64位的。

licess 发表于 2012-8-6 19:46:20

应该不是,我都用debian

cnmt 发表于 2012-8-7 20:35:10

debian都是最小化装的。直接装的lnmp
没装别的。
页: [1]
查看完整版本: 已改好了。502.sh代码。但在用./502.sh时。他显示的是他的内容。是什么问题。