在bash手册中,写道 Builtin commands are contained >>> within <<< the shell itself 另外,这个答案指出 A built-in command is simply a command that the shell carries out itself, instead of interpreting it as a request to load and run some >>> other program <<< 在上运行compgen -b时bash 4.4,我会收到所有shell内置命令的列表。我看到例如,[并且kill被列为shell内置程序。但是它们的实际位置是: /usr/bin/[ /bin/kill 我认为这是builtin将命令编译为/bin/bash可执行文件的一种手段。因此,真正使我感到困惑的是:请纠正我,但是builtin当一个单独的命令实际上不属于shell的一部分时,它又如何成为a 呢?
我有一个在Debian(Jessie)服务器上运行的服务(由我自己编写),该服务自己的日志恰好表明它在特定时间重新启动。没有迹象表明存在段错误或其他崩溃,因此我现在试图确定应用程序是否以某种方式静默失败并被systemd重新生成,或者用户是否通过故意重新启动了服务systemctl。 外壳程序历史记录未显示此类活动,但是export HISTCONTROL=ignoreboth由于SSH会话可能已超时,从而阻止了先前登录名的bash历史记录写入磁盘,因此尚无定论。当时服务器未重启。 但是我希望systemd本身应该保留一个日志,指示何时有意重新启动服务。令我惊讶的是,我找不到任何journalctl有关如何获取此类日志的文档(例如)。 其他一些帖子(例如,哪里/为什么普通用户systemd服务没有日志?)似乎表明应该有这样的日志消息: Jan 15 19:28:08 qbd-x230-suse.site systemd[1]: Starting chatty.service... Jan 15 19:28:08 qbd-x230-suse.site systemd[1]: Started chatty.service. 但是我在系统上看不到这样的日志消息。 有没有办法找出何时启动,停止或重新启动systemd服务? 编辑:看来人们可能遇到的典型问题是他们journalctl以非特权用户身份运行。对我来说不是这样,我一直都在工作root。作为对评论的回应,运行grep systemd /var/log/syslog仅给我以下内容: Jun 6 09:28:35 server systemd[22057]: Starting Paths. Jun 6 09:28:35 server systemd[22057]: Reached target Paths. Jun 6 09:28:35 server systemd[22057]: Starting Timers. Jun 6 09:28:35 server …