I want to create an alarm clock-like app on Ruby.

Asked 2 years ago, Updated 2 years ago, 73 views

I would like to operate irkit on time with Ruby to achieve home automation.
It seems that gem "clockwork" can run at the specified time, but clockworkd-c clock.rb start and daemon or the foreground process must run, and naturally, just editing clock.rb does not reflect the schedule.
clockworkd-c clock.rb restart was reflected, but is there any other way besides clockwork?
This image allows you to stand up on a different thread during web-side rackup without executing shell commands and add, delete, or change schedules with ruby code.

ruby clockwork rubygems

2022-09-30 10:37

1 Answers

I looked at the source code for https://github.com/Rykian/clockwork, and it looked like this:

Although clockworkd has been daemonsized, it seems that the operation in restart is to require the new clock.rb, terminate the previous process, and run clockwork.run in the new process.In conclusion, there is no other way to reread the new clock.rb than clockworkd-cclock.rb restart and daemon restart.In other words, the clockwork itself has not been created to be reread by processes that are already running.

I think clockworkd-c clock.rb start using system etc. in the rackup, but once the clock.rb is rewritten, the only way to deal with it is to clockworkd-clock.rb restart.


2022-09-30 10:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.