如果rails服务器未启动,是否也可以启动memcache?
如果memcached没有启动的话,你能让命令'rails server'也启动它吗?
Can you make the command 'rails server' also start memcached if it isn't started?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以让该脚本做很多事情,但这并不意味着这样做是个好主意。您应该使用专为保持进程运行而设计的工具,例如 god 或 monit。
在开发机器上,我仍然可能不会破解我的 Rails 脚本,而是编写一个为我完成这两件事的 shell 脚本。
编辑:回应下面的评论。
好吧,这是最简单的 shell 脚本。您可以将其存储在任何地方(例如
/usr/local/bin
),但您需要位于 RAILS_ROOT 目录中才能运行它。dev_servers.sh
You could make that script do lots of things, but that doesn't mean it's a good idea to do so. You should use a tool designed for the job of keeping processes up, like god or monit.
On a development box, I still probably wouldn't hack my rails script, but would instead write a shell script that does both things for me.
Edit: Responding to the comments below.
Alright, here's the simplest possible shell script. You can store it anywhere (like
/usr/local/bin
), but you need to be in a RAILS_ROOT directory to run it.dev_servers.sh
您可以创建一个执行此操作的初始化程序:
警告:我尚未测试其适用性。
You could create an initializer that does it:
WARNING: I haven't tested this for suitability.