找到 apache2ctl
我可以说 apache2ctl 很优雅,我的网络服务器在交互式 shell 中重新启动。一切都很好。但是,我需要在 shell 脚本中说明这一点,因此我需要 apache2ctl 的完整路径。我尝试过which和locate,但什么也没出现,这让我非常惊讶。我查看了/usr/bin,没有apache2ctl。我如何知道它住在哪里?
我想也许它会在 /opt/local/apache2/bin 中,但那里有一个 apachectl...而不是 apache2ctl。我很困惑。有什么想法吗?
@Jon Lin - 干得好...类型 apache2ctl 告诉我 apache2ctl 是别名 sudo /opt/local/apache2/bin/apachectl'` 。非常感谢。
I can say apache2ctl graceful and my webserver restarts at an interactive shell. All is well. However, I need to say that in a shell script so I need the full path for apache2ctl. I have tried which and locate but nothing turns up which makes me very surprised. I looked in /usr/bin and there is no apache2ctl. How do I figure out where this lives?
I thought maybe it would be in /opt/local/apache2/bin but there is an apachectl in there...not a apache2ctl. I'm stumped. Any ideas?
@Jon Lin - Nice work...type apache2ctl told me apache2ctl is aliased to
sudo /opt/local/apache2/bin/apachectl'` . Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它应该位于 /usr/sbin 或 /usr/local/sbin 中
It should be in /usr/sbin or /usr/local/sbin
您可能需要在
locate
之前运行updatedb
以防万一,或者您可以运行
find / -name 'apache2ctl' 2>; /dev/null
搜索整个分区You probably need to run
updatedb
beforelocate
just in caseOr you can run
find / -name 'apache2ctl' 2> /dev/null
to search for your entire partition您尝试过
which
吗? (不确定 Mac 上是否存在,尽管它在大多数 *nix 系统上相当标准;其行为与 Windows 上的where
类似)。Did you try
which
? (Not sure if that'd be present on a Mac, though it's pretty standard on most *nix systems; behaves rather likewhere
on windows).