0
你如何在cron中運行ruby腳本並讓它加載所有'require'寶石?我踢了這個Ruby腳本作爲子在python:Python /紅寶石:cronjob將不會加載紅寶石寶石?
!#/usr/bin/env python
...
def ruby_importdb(import_this):
if formatinput == 'nessus':
print '[+] importing the report to the database'
subprocess.Popen(["/usr/local/rvm/rubies/default/bin/ruby /scripts/nessus-xml2db.rb " + import_this],
shell=True, stdout=subprocess.PIPE, universal_newlines=True)
的cronjob如下:
51 11 * * * /scripts/nessus-export-scans-nes.py 2>&1 | logger
在/ var活動/ log/messages中顯示以下錯誤時,Python腳本改掉執行紅寶石子功能:如果我從我的用戶帳戶或root身份運行此腳本
root: /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- mysql (LoadError)
root: #011from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'
root: #011from /scripts/nessus-report-database/nessus-xml2db.rb:3:in `<main>'
代碼工作找到。