require 'open4' require 'fileutils' module Rubber module Commands class Cron < Clamp::Command def self.subcommand_name "cron" end def self.subcommand_description "A cron-safe way for running commands" end def self.description Rubber::Util.clean_indent( <<-EOS Runs the given command, sending all stdout/stderr to a logfile, but echoing the entire file if the command exits with an error. Exits with the same error code the command exited with EOS ) end # options for all tasks option ["-e", "--echoerr"], :flag, "Log _and_ echo stderr", :default => false option ["-o", "--echoout"], :flag, "Log _and_ echo stdout", :default => false option ["-r", "--rootdir"], "ROOTDIR", "Root dir to cd into before running\n (default: )" option ["-l", "--logfile"], "LOGFILE", "Logs output to the given file\n (default: /log/cron-sh-