每当我启动ubuntu机器时,都会自动启动Rails服务器 [英] Start rails server automatically when ever I start my ubuntu machine

查看:95
本文介绍了每当我启动ubuntu机器时,都会自动启动Rails服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rails应用程序,我想在机器启动时自动启动服务器.现在,我进入目录,然后键入rails s命令.如何配置我的机器以在引导时运行我的Rail服务器?我正在使用Ubuntu和Rails 3.0.0.

I have a rails application and I want to start the server automatically whenever the machine boots up. Right now I cd to the directory and then type the rails s command. How can I configure my machine to run my Rail server on boot? I am using Ubuntu and Rails 3.0.0.

推荐答案

您可以为此使用cron作业.要添加cron作业,请使用命令crontab -e.比您可以定义在启动时运行的cron作业,然后使用@reboot command重启.

You can use a cron job for this. To add the cron job use the command crontab -e. Than you can define a cron job that runs at boot and reboot with @reboot command.

所以您会遇到类似的事情:

So you'd have something like:

@reboot cd /home/[path to project] && rails server

这篇关于每当我启动ubuntu机器时,都会自动启动Rails服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆