cron任务执行python脚本显示/bin/bash c前缀(显示在htop监视器上)

2024-09-30 18:23:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我每5分钟就在cron任务上运行许多python脚本

在HTOP监视器上查看时,我看到一些od调用以“/bin/bash-c”开头

您可以在所附图片中看到: enter image description here

这是什么意思? 这是否意味着任务已执行?在


Tags: 脚本bashbincron监视器htopod附图片
2条回答

cron调用/bin/sh -c YourCommandHere执行任务。
所以它产生了'/bin/sh. After that shell executes your command, so it startspython/path/to/脚本.py. This command also spawnspython`,它执行脚本。在

只要看一下pstree,就会看到类似cron -> sh -> python -> python

/bin/bash -c command_string表示要在shell中执行的命令是从参数command_string读取的。您可以在bash手册中使用man bash来阅读它。所以这意味着任务已经执行了。在

-c If the -c option is present, then commands are read from the first non-option argument command_string. If there are arguments after the command_string, they are assigned to the positional parameters, starting with $0.

相关问题 更多 >