2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

『crond: can't lock /var/run/crond.pid, otherpid may be 1234: リソースが一時的に利用できません』の解決方法

Posted at

ネット上の情報で解決できなかったので、同じ境遇の人のためにここに残しておきます。

$ cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 

遭遇したエラー

crond startcrond statusすると、crond: can't lock /var/run/crond.pid, otherpid may be 1234: リソースが一時的に利用できませんと表示されてめちゃくちゃムカつく。

ネット上の情報

このエラーは珍しくもない様で、検索するとたくさん出てくる。しかし、検索して出てくる解決方法はほぼ全て以下の方法。

  1. rm /var/run/crond.pidで削除。

  2. ps ax | grep crondを実行して出てくるcrondのプロセスを全てkillする。

  3. crond startで起動。

実際、これでほとんどの人は解決している様なので試してない人は是非試してみてほしい。けど、僕の場合はどんな順番でPIDを削除しcrondを起動しようがずっと

crond: can't lock /var/run/crond.pid, otherpid may be 1234: リソースが一時的に利用できません

crond: can't lock /var/run/crond.pid, otherpid may be 1234: リソースが一時的に利用できません

crond: can't lock /var/run/crond.pid, otherpid may be 1234: リソースが一時的に利用できません

と表示され続けた。3時間もそれは続いた。

解決方法

  1. とりあえずすでにあるプロセスとPIDファイルは消す。
  2. systemctl start crondする。

ポイントはcrond startcrond statusをしないこと。crond startcrond statusをするとリソースが一時的に利用できませんになるという単純な話だった。

これでも解決しなかったら

プロセスのリミットが原因の場合、/etc/security/limits.conf

root	-	nproc	unlimited

を追加したら解決した、みたいな記事を見かけた。
僕はこの方法で解決しなかったがもしかしたらこれで解決するかも。

2
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?