【发布时间】:2014-02-13 17:55:30
【问题描述】:
我正在尝试访问 PHP 网址并使用 cron 作业和 wget 发布有关我的 linux 机器的一些信息。
*/30 * * * * wget -O /dev/null http://ping.xxx.com/xxx/up.php?mac=`ifconfig eth1 | awk '/HWaddr/ { print $5 }`\&uptime=`uptime`\&ip=`ifconfig eth1 | awk '/inet addr:/ {sub(/addr:/, "", $2); print $2 }`;
在 php 方面,我正在尝试获取 mac、uptime 和 ip 等请求参数,但我只能记录 mac。我认为的原因是因为 uptime 命令有 23:42:10 up 22 min, load average: 0.00, 0.01, 0.04 作为输出,这可能会破坏 wget 进程。运行 wget 时收到以下消息
wget: not an http or ftp url: 23:42:10
谁能告诉我如何正确传递参数?
【问题讨论】:
标签: php linux unix wget uptime