Detecting a stale pid file in a Unix environment

后端 未结 1 384
北恋
北恋 2021-01-28 00:20

What is the standard, cross-platform way to detect stale pid file in a Unix environment? Say I would like to kill an old instance of my application, but I certainly don\'t want

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-28 00:42

    File times at /proc/ date back to at least 1991; see p. 243. And, although mtime can be faked (e.g. via touch -m --date= ), for a userland app there is no way to do so on its own /proc/ entry.

    0 讨论(0)
提交回复
热议问题