I need to run a cron job every 5 mins, and to accomplish this I have a manifest.
class cron_job{
file{"puppet_ls":
path => "/puppet/pls.sh",
ensure => present,
content => "#!/bin/sh\necho \"Hello World\"\nls -ltr /etc/puppet > /puppet/dump.txt"
}
file { "my_ls.cron":
path => "/etc/cron.d/my_ls.cron",
ensure => present,
owner => "root",
group => "root",
mode => 0644,
require => File["puppet_ls"],
content => "*/1 * * * * /puppet/pls.sh\n";
}
}
This manifest creates a file /puupet/pls.sh with the content specific, that is actually running the command ls-ltr /etc/puppet and * * * * /puppet/pls.sh\n, specifies to run it after every 1 minute.
But I am not getting the file dump.txt inside /puppet/ whereas if I run, sh /puppet/pls.sh, it runs successfully and generates the dump file.
What is the glitch here? Can Somebody help?