mwp*_*mwp 4 systemd systemd-journald
我sh -c exec在ExecStart语句中(在服务单元文件中)使用习语来插入一些 shell 命令。例如:
ExecStart=/bin/sh -ec "exec /usr/bin/foo $(/usr/bin/foo-config)"
Run Code Online (Sandbox Code Playgroud)
它工作得很好。但是,当我查看此服务的日志时,进程名称sh不是foo. 有没有办法使用这个习语来对进程名称撒谎?
啊,结果证明这比我想象的要容易得多。在这里找到答案:https : //unix.stackexchange.com/a/229525/11995!
SyslogIdentifier=foo
Run Code Online (Sandbox Code Playgroud)