2014-02-19 111 views
0

我需要在Ubuntu 12.04上始终运行Ruby脚本。 现在我连接到服务器在腻子和键入“ruby execute.rb”,但与关闭或断开控制台,将停止如何在后台系统启动时运行ruby脚本

如果我添加“ruby execute.rb”到我的〜/ .bash_profile - 当我连接到服务器在腻子,我的窗前,保持这个剧本,我不能键入其他命令

所以,我想,脚本工作始终,如果系统重新启动后,我可以使用任何命令,在终端

回答

0

要运行脚本在系统启动时,您可以将您的命令放入/etc/rc.local

# This script is executed at the end of each multiuser runlevel. 
# Make sure that the script will "exit 0" on success or any other 
# value on error. 
+0

我添加到rc.local:“cd/var/www/nw; screen -d -m ruby​​ execute.rb” 但是当我通过putty连接并键入“screen -r” - 我看不到任何屏幕 该命令在〜/ .bashprofile中正常工作,但我需要在系统启动时运行命令(不是用户连接) – user2572790

相关问题