为什么我的脚本不能在 FreeBSD 上运行? (awk: 语法错误)
Why does my script not work on FreeBSD? (awk: syntax error)
为什么 this 脚本不能在 FreeBSD 上运行?我 运行 Centos 和 Debian 上的脚本,一切正常。在 FreeBSD (10.2) 上,我遇到以下错误:
awk: syntax error at source line 1
context is
match([=10=], "^listen >>> queue:[[:space:]]+(.*)", <<<
awk: bailing out at source line 1
-0.9902
例如,这里是 php-form status 的一些输出:
pool: www
process manager: ondemand
start time: 29/Feb/2016:15:18:54 +0200
start since: 2083770
accepted conn: 1467128
listen queue: 0
max listen queue: 129
listen queue len: 128
idle processes: 1
active processes: 2
total processes: 3
max active processes: 64
max children reached: 1
slow requests: 0
在 Centos 和 Debian 上,当我 运行:
/path/to/script/php-fpm-check.sh "idle processes" http://127.0.0.1/status
我得到 1
,但在 FreeBSD 上出现上述错误。
match
的 3 参数形式是 GNU awk 扩展 (docs)。你必须找到另一种方法来捕获匹配(可能使用 RSTART 和 RLENGTH 变量设置为 match() 的副作用),或者在你的 freebsd 系统上安装 gawk。
为什么 this 脚本不能在 FreeBSD 上运行?我 运行 Centos 和 Debian 上的脚本,一切正常。在 FreeBSD (10.2) 上,我遇到以下错误:
awk: syntax error at source line 1
context is
match([=10=], "^listen >>> queue:[[:space:]]+(.*)", <<<
awk: bailing out at source line 1
-0.9902
例如,这里是 php-form status 的一些输出:
pool: www
process manager: ondemand
start time: 29/Feb/2016:15:18:54 +0200
start since: 2083770
accepted conn: 1467128
listen queue: 0
max listen queue: 129
listen queue len: 128
idle processes: 1
active processes: 2
total processes: 3
max active processes: 64
max children reached: 1
slow requests: 0
在 Centos 和 Debian 上,当我 运行:
/path/to/script/php-fpm-check.sh "idle processes" http://127.0.0.1/status
我得到 1
,但在 FreeBSD 上出现上述错误。
match
的 3 参数形式是 GNU awk 扩展 (docs)。你必须找到另一种方法来捕获匹配(可能使用 RSTART 和 RLENGTH 变量设置为 match() 的副作用),或者在你的 freebsd 系统上安装 gawk。