I am using Rufus Scheduler to run another Ruby script every two minutes. The script runs once, but never again. Is there an error in my code? HTOP shows that "launcher.rb" continues to exist as a process after the "script.rb" code runs once.
#launcher.rb
require "rubygems"
require "rufus-scheduler"
scheduler = Rufus::Scheduler.new
scheduler.every("2m")do
require "/home/pi/Bots/script.rb"
end
scheduler.join
You could try with
It may work ("may" because I don't know exactly what's in your script.rb).
requirewill not load and run again whatever behind your "home/pi/Bots/script.rb" whileloadwill load and run each time.What happens with your current launcher is that require is called every 2 minutes, but only the first time does it load and run the script.rb.
Please note that the following might be better:
See Kernel#load and Kernel#require