lib/s3log/cron.rb in s3log-0.0.3 vs lib/s3log/cron.rb in s3log-0.0.4
- old
+ new
@@ -2,11 +2,11 @@
class Cron
def initialize(configfile)
@configfile = configfile
@config = YAML::load_file(configfile)
- @path = File.dirname(configfile)
+ @path = File.dirname(File.expand_path(configfile))
@jobname = @config['jobname']
@schedule = @config['schedule']
@logdir = @config['logdir']
FileUtils.mkdir(@logdir) unless Dir.exists? @logdir
S3log::Log.set_logger(File.join(@logdir, 's3log.log'), @config['loglevel'])
@@ -25,12 +25,12 @@
end
end
tmp_cron_file << "# S3log job #{@jobname}\n#{line}" unless included
tmp_cron_file.fsync
if system("crontab #{tmp_cron_file.path}")
- S3log::Log.info "[update] crontab updated."
+ S3log::Log.info "#{@jobname} [update] crontab updated."
else
- S3log::Log.warn "[fail] Couldn't write crontab."
+ S3log::Log.warn "#{@jobname} [fail] Couldn't write crontab."
tmp_cron_file.close!
exit(1)
end
end