Use whenever to record the run time of the Lake task in the Rails project
job_type:rbenv_rake, %q {PATH="/opt/rbenv/bin:/usr/local/bin:$PATH";eval"$(rbenv init-)"; cd:path&&:environment_variable=:environment nice-10:bundlemental-nundra}
set:output, "log/cron_foo.log"
every"10 1 * *"do
rbenv_rake "foo:update"
end
I'm thinking of throwing up the current time in foo:update
, but is there a cleaner way to log the start and end times only when calling from whenever
?
It was a little uncomfortable to write the same process for all the Lake tasks, not DRY, so please let me know if you have any good ideas.
If not, I would like to use the script to output the time to the standard output.
I use CentOS on the server, but I would appreciate it if there was a way to use both Ubuntu and CentOS.
ruby-on-rails rake whenever
If your operating system is ubuntu, the start and end times of cron are logged to /var/log/auth.log
by default.The syslog should have a record of the execution of the +1 process for this PID, so if you associate it with it, you will know how long the task will run.However, we could not find the documentation for whether auth.log and syslog PIDs are guaranteed to be +1.
/var/log/auth.log
May 400:00:00 server_name CRON [9520]:pam_unix(cron:session):session opened for user_name
May 400:00:08 server_name CRON [9520]: pam_unix(cron:session): session closed for user_name
/var/log/syslog
May 400:00:01 server_name CRON [9521]:(user_name)CMD(/bin/bash-l-c'cd/home/user_name/xxxx&RAILS_ENV=production script_name')
© 2024 OneMinuteCode. All rights reserved.