# File lib/whenever/command_line.rb, line 59
    def write_crontab(contents)
      tmp_cron_file = Tempfile.new('whenever_tmp_cron').path
      File.open(tmp_cron_file, File::WRONLY | File::APPEND) do |file|
        file << contents
      end

      command = ['crontab']
      command << "-u #{@options[:user]}" if @options[:user]
      command << tmp_cron_file

      if system(command.join(' '))
        action = 'written' if @options[:write]
        action = 'updated' if @options[:update]
        puts "[write] crontab file #{action}"
        exit(0)
      else
        warn "[fail] Couldn't write crontab; try running `whenever' with no options to ensure your schedule file is valid."
        exit(1)
      end
    end