1
0

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.

Squidが起動しない…

Last updated at Posted at 2019-02-01

プロキシサーバ Squid 、たまに iPhone から MacBook 上のWebサーバに接続する際に使うんですが、どういうタイミングからなのか正常に起動できなくなっていました。

「(プロセス起動してるかな…)」

[~]$ ps aux | grep squid
minto             8776   0.0  0.0  4267752    876 s001  S+    4:35PM   0:00.00 grep squid

「(あれ、起動してない)」
「(brew経由だったはずなんだけど、起動してなかったっけ…)」

[~]$ brew services list | grep squid
squid                      started minto /Users/minto/Library/LaunchAgents/homebrew.mxcl.squid.plist

「(あれ、起動してるやんけ)」
「(とりあえず起動し直してみるか)」

[~]$ brew services stop squid
Stopping `squid`... (might take a while)
==> Successfully stopped `squid` (label: homebrew.mxcl.squid)
[~]$ brew services start squid
==> Successfully started `squid` (label: homebrew.mxcl.squid)
[~]$ ps uax | grep squid
minto             9541   0.0  0.0  4267752    876 s001  S+    4:37PM   0:00.00 grep squid

「(???)」
「(えーと・・・)」

[~]$ squid
-bash: squid: command not found

「(あれ? パス通ってない? なんで?)」

[~]$ brew info squid
squid: stable 3.5.28 (bottled), HEAD
Advanced proxy caching server for HTTP, HTTPS, FTP, and Gopher
http://www.squid-cache.org/
/usr/local/Cellar/squid/3.5.28 (2,071 files, 9.3MB) *
  Poured from bottle on 2019-02-01 at 12:06:09
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/squid.rb
==> Dependencies
Required: openssl ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
To have launchd start squid now and restart at login:
  brew services start squid
Or, if you don't want/need a background service you can just run:
  squid
==> Analytics
install: 329 (30 days), 1,091 (90 days), 5,280 (365 days)
install_on_request: 310 (30 days), 1,020 (90 days), 4,765 (365 days)
build_error: 0 (30 days)

「(…直接コマンド実行してみるか)」

[~]$ /usr/local/Cellar/squid/3.5.28/sbin/squid
[~]$ ps aux | grep squid
minto            10081   0.0  0.0  4267752    884 s001  S+    4:41PM   0:00.00 grep squid

「(これもダメなのかよ)」
「(…なんとなくsudo実行してみるか)」

[~]$ sudo /usr/local/Cellar/squid/3.5.28/sbin/squid
Password:
WARNING: Cannot write log file: /usr/local/var/logs/cache.log
/usr/local/var/logs/cache.log: Permission denied
         messages will be sent to 'stderr'.
Squid is already running!  Process ID 391

「(あれ、 Squid is already running! の扱いなのか…??)」
「(じゃあPIDを覚えちゃってて停止処理でおかしくなった可能性があるのか。)」
「(…PIDファイルどこだ???)」

[~]$ ll /var/run/squid.pid
ls: /var/run/squid.pid: No such file or directory

「(ないか…)」

squid : pid_filename configuration directive

[~]$ grep 'pid_filename' /usr/local/etc/squid.conf

「(squid.conf にも定義されてないのか。環境依存なんだろうか…。デフォルトどこなのかよくわからんな…。)」
「(じゃあもう再定義するか)」

[~]$ vi /usr/local/etc/squid.conf

pid_filename /var/run/squid.pid
[~]$ brew services stop squid
Stopping `squid`... (might take a while)
==> Successfully stopped `squid` (label: homebrew.mxcl.squid)
[~]$ brew services start squid
==> Successfully started `squid` (label: homebrew.mxcl.squid)
[~]$ ps aux | grep squid
minto            10274   0.0  0.0  4267752    876 s001  S+    4:59PM   0:00.01 grep squid
minto             9840   0.0  0.1  4305104  14748   ??  S     4:37PM   0:00.13 /usr/local/opt/squid/sbin/squid -N -d 1
[~]$ ll /var/run/squid.pid
-rw-r--r--  1 root  daemon  6  2  1 16:42 /var/run/squid.pid

「(………)」

SEE YOU SPACE COWBOY…

1
0
0

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?