Class: Specinfra::Command::Solaris::Base::Cron

Inherits:
Base::Cron show all
Defined in:
lib/specinfra/command/solaris/base/cron.rb

Class Method Summary collapse

Methods inherited from Base

create, escape

Class Method Details

.check_has_entry(user, entry) ⇒ Object


3
4
5
6
7
8
9
10
# File 'lib/specinfra/command/solaris/base/cron.rb', line 3

def check_has_entry(user, entry)
  entry_escaped = entry.gsub(/\*/, '\\*').gsub(/\[/, '\\[').gsub(/\]/, '\\]')
  if user.nil?
    "crontab -l | grep -- #{escape(entry_escaped)}"
  else
    "crontab -l #{escape(user)} | grep -- #{escape(entry_escaped)}"
  end
end