Rail jobs do not free file log files

I am running a running rail job that sends some emails based on the contents of the database. Work is done every four hours through cron.

I realized that this creates a problem on our b / c application server, when the runner’s task is held on some file log handlers (production.log, etc.), and then the night logrotate task fails. This causes the disk space to become full, etc.

Runner jobs reference the Rails workspace, execute a couple of ActiveRecord requests, send an email through ActionMailer, and then shut down. I do not do anything with magazines.

Is there something I can do inside the runner script to free the log descriptors or disable logging altogether (most likely it will not do the latter)? And should I formally kill the Rails process? the script ends ... but sometimes we see such elements in our process list after completing the task:

4 S 1000 12008 12002 0 80 0 - 127507 futex_ Sep29? 00:00:32 ruby ​​/ path / to / my / app / rails runner -e production requires "delayed / command", Delayed :: Worker.before_fork; Delayed :: Command.new ([]). Run

+4
source share
1 answer

all you have to do is change the log level for the environment file.

config.log_level = :fatal

Your environment file will look like this:

config/environments/production.rb

, , , , . ( )

, :

config/environments/my_custom_environment.rb

, . database.yml my_custom_environment, . , .

, , script my_custom_environment.

, ( , ), , , .

, :)

0

All Articles