I want to add 1 cron job to a machine that will run every 5 minutes, because I use this 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";
}
}
So this manifesto does 2 things
- It creates a file /puupet/pls.sh with content content, which actually executes the ls-ltr / etc / puppet command
- It writes in the form of a cron job for the daily category, and if you see the last line, that is * * * * / puppet / pls.sh \ n , it says that it starts after every 1 minute (for testing, I saved one)
But I don’t get the dump.txt file inside / puppet /
Also, if I run sh / puppet / pls.sh , it works fine and generates a dump.
I can’t understand where the glitch is .. :(
.