Method: Specinfra::Command::Solaris::Base::Cron.check_has_entry

Defined in:
lib/specinfra/command/solaris/base/cron.rb

.check_has_entry(user, entry) ⇒ Object

[View source]

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