如何使诊断程序“通过CLI管理进程”显示“OK(正常)”?

2023-04-18 17:00:15 浏览数 (1)

在Matomo Diagnostics中,有一个“设置Cron -通过CLI管理进程”的复选框。让它正常工作是很有帮助的,特别是当您管理一个高流量的Matomo实例时,或者如果有很多网站或片段需要存档(了解更多关于提高Matomo性能的信息)。

For this diagnostic “Setup Cron – Managing processes via CLI” to work OK you need:

要使此诊断程序“Setup Cron - Managing processes via CLI”正常工作,您需要:

  • The following PHP functions must be enabled: shell_exec, getmypid (these are available by default in PHP but may have been disabled manually)
  • 必须启用以下PHP函数:shell_exec,getmypid(PHP中默认提供,但可能已手动禁用)
  • The system must provide the following commands: ps, awk (these are available by default in Linux systems)
  • 系统必须提供以下命令:ps、awk(这些在Linux系统中默认可用)
  • The proc filesystem needs to be mounted at /proc for the ps x command to work (this is the default on linux systems)
  • 该 过程 文件系统需要装载在 /处理 对于 ps x命令工作(这是linux系统的默认值)
  • The which package needs to be installed and working
  • 该 其中软件包需要安装并正常工作

Notes:

注:

  • this is not supported on Windows 在Windows上不支持此操作
  • this is not supported on Synology devices Synology设备不支持此功能
  • in some cases the configuration for web will have these functions disabled (For example if you have different INI files for CLI and web) 在某些情况下,Web配置将禁用这些功能(例如,如果您有CLI和Web的不同INI文件)

You can manually test if Managing processes via CLI is supported by running the following command in your server:

您可以通过在服务器中运行以下命令来手动测试是否支持通过CLI管理进程:

代码语言:javascript复制
./console diagnostics:run --all | grep -i "processes via cli"

If it returns Setup Cron - Managing processes via CLI: INFORMATIONAL not supported (optional) learn more then it means that it is not supported yet (even on CLI). To troubleshoot why, and find out how to solve this issue, here are the following commands that should be running (from your terminal or SSH window as the Matomo user) for the diagnostic to display OK:

如果返回Setup Cron -通过CLI管理进程:INFORMATIONAL not supported(可选)了解更多信息,则意味着它还不受支持(即使在CLI上)。要查找原因并找出解决此问题的方法,应运行以下命令(以Matomo用户身份从您的终端或SSH窗口),以使诊断显示OK:

代码语言:javascript复制
ps -e
# Should return a list containing PID, TTY, TIME and CMD for ps

awk -V
# Should return the installed version of awk, for example GNU Awk 4.2.1, API: 2.0

ls /proc
# Should return the full contents of the /proc folder

php -r "var_dump(function_exists('shell_exec'));"
php -r "var_dump(function_exists('getmypid'));"
# Should both return bool(true)

which
#should return nothing, if which is not installed it will return "command not found"
#in this case you will need to install the which package from your distributions repository

0 人点赞