Class: Flydata::Cron
- Inherits:
-
Object
- Object
- Flydata::Cron
- Defined in:
- lib/flydata/cron.rb
Constant Summary collapse
- FLYDATA_HOME =
Flydata::HOME_DIR
- CRON_TMP_PATH =
"#{FLYDATA_HOME}/cron_list.tmp"
- CRON_BACKUP_PATH =
"#{FLYDATA_HOME}/cron_list.back"
- LOG_PATH =
"#{FLYDATA_HOME}/flydata_cron.log"
- ROUTINE_BASE_COMMAND =
"#{FLYDATA_HOME}/bin/flydata routine >> #{LOG_PATH} 2>&1"
- ROUTINE_COMMAND =
ROUTINE_BASE_COMMAND
- CRON_LINE =
"15 4 * * * #{ROUTINE_COMMAND}"
- REMOVE_OPTION =
CRON_LINE=“* * * * * #ROUTINE_COMMAND”
"-r"
Instance Method Summary collapse
-
#initialize ⇒ Cron
constructor
A new instance of Cron.
- #update(option = nil) ⇒ Object
Constructor Details
#initialize ⇒ Cron
Returns a new instance of Cron.
18 19 |
# File 'lib/flydata/cron.rb', line 18 def initialize end |
Instance Method Details
#update(option = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/flydata/cron.rb', line 20 def update(option=nil) arg = option ? option : '' # Check condition check_crontab_command dump_cron_setting reagistered = check_cron_setting # Remove mode if arg == REMOVE_OPTION unless reagistered puts "Skip removing. There are no flydata jobs in crontab." else remove_cron_setting puts "Updated crontab to remove the deletion of your log data." end # Add mode else if reagistered puts "Skip register. Already cron setup done." else add_cron_setting puts "Updated crontab to manage the deletion of your log data." end end true end |