我已经通过自制软件安装了memcached。
如何启动/停止服务器?
是否有任何与memcached进行交互的命令行工具?
家酿有办法去除包裹吗?
Answers:
Brew曾经有一个命令Brew服务(https://thoughtbot.com/blog/starting-and-stopping-background-services-with-homebrew),现已弃用。相反,要获得始终正确的建议,请运行以下命令:
brew info memcached
通过telnet: telnet localhost 11211
brew remove memcached
当你安装了它,它把一个文件名为homebrew.mxcl.memcached.plist
中/usr/local/Cellar/memcached/$version/
; 您将该文件复制到~/Library/LaunchAgents
,然后告诉launchd以开头launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
。
如果您在brew install
命令期间仔细观察控制台,它应该已经对执行这些确切步骤有所帮助。如果运行,brew info
它将重新打印此信息,例如brew info memcached
。
您可能应该阅读https://docs.brew.sh/Manpage-它具有更有用的文档,包括brew remove
命令,如果您决定不希望使用该软件包,它将删除该软件包。
launchctl unload -w ~/Library/LaunchAgents/com.danga.memcached.plist
当然。:)
~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
另外,如果您忘记了说明,则可以运行“浏览信息”。
→ brew info memcached
memcached 1.4.7
http://memcached.org/
Depends on: libevent
/usr/local/Cellar/memcached/1.4.6 (8 files, 156K)
You can enable memcached to automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/memcached/1.4.7/com.danga.memcached.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist
Or start it manually:
/usr/local/bin/memcached
Add "-d" to start it as a daemon.
http://github.com/mxcl/homebrew/commits/master/Library/Formula/memcached.rb
要重新启动:如果您的memcached启动为launchd并且您的plist文件包含
<key>KeepAlive</key>
<true/>
然后,您可以终止该进程,它将自动重启。
ps ux | grep memcached
pkill -f memcached
ps ux | grep memcached
要停止从自动重启启动:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
要将memcached添加到再次启动:
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
卸载自制软件安装的东西:
brew uninstall memcached
您还可以创建别名
alias memcached-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist"
alias memcached-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist"
alias memcached-restart="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist;launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist"
之后,您就无法轻松启动/停止/重启memcached
memcached-start
memcached-stop
memcached-restart