Automatically run whenever -w?

50 views
Skip to first unread message

ra...@heartlandmacs.com

unread,
Jan 5, 2017, 11:03:00 AM1/5/17
to Whenever Gem
Hello All, 

I'm kind of a n00b, so please forgive me if this is super easy or really stupid, but I'm trying to use whenever in a way that I think it was not originally intended. Basically I made an app for a school bell system so that school admins can set and change times for bells to ring on a webpage, and then whenever makes the schedule. However, I have to manually run `whenever -w` each time they make a change. I've tried to have whenever run a script, but that doesn't seem to work. The task in 'schedule.rb' that calls the 'run_whenever.rb' script does work, I can see that it's being called by cron in my logs, but the crontab does not update. Does anyone have any suggestions? My files are as below:

/config/schedule.rb:
##################################################
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
set :path, Rails.root
set :output, Rails.root.join('log', 'cron.log')

Schedule.find_each { |schedule|
every %(#{schedule.min} #{schedule.hour} * * #{schedule.dow}) do
command "/home/dev/Herrald/play.sh"
end
 }

every 15.minutes do
command "/home/dev/Herrald/run_whenever.rb"
end


##########################################

run_whenever.rb:
################################
#!/usr/bin/env ruby

Dir.chdir("herrald_web") do
  system "whenever -w &"
end

##################################

crontab -l result:
#################################
# Begin Whenever generated tasks for: /home/dev/herrald_web/config/schedule.rb
00 12 * * 6 /bin/bash -l -c '/home/dev/Herrald/play.sh'

0,15,30,45 * * * * /bin/bash -l -c '/home/dev/Herrald/run_whenever.rb'


# End Whenever generated tasks for: /home/dev/herrald_web/config/schedule.rb
####################################

Reply all
Reply to author
Forward
0 new messages