使用传递变量从 ruby​​ on rails 执行 shell 脚本 [英] execute shell script from ruby on rails with passing variable

查看:66
本文介绍了使用传递变量从 ruby​​ on rails 执行 shell 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 prosody xmpp 服务器与我的 rails 应用程序集成.我需要在注册时在数据库中创建一些用户,以便稍后在韵律服务器中使用它们.

Im trying to integrate prosody xmpp server with my rails application. I need to create some users in a database upon registration so I can lateron use them inside the prosody server.

在 rails 中运行 shell 命令并输出任何信息日志的最佳方法是什么?

What would be the best way to run shell commands in rails and output any info logs ?

prosodyctl adduser User.username

推荐答案

我通常用 system(command) 运行,或者用反引号 command 运行,其他方式你可以参考这里

i usually run with system(command),or with backtick command,other way you can refer here

这篇关于使用传递变量从 ruby​​ on rails 执行 shell 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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