cronjob every 15 minutes

3,910 views
Skip to first unread message

Rupert

unread,
Jul 2, 2009, 3:04:25 AM7/2/09
to Puppet Users
Hello,
im trying to create a class that creates a cronjob that is run ever 15
minutes on 2 Servers.
These jobs should run at 15 and 45 on one server and on 0 and 30 on
the other server.
When i set a variable to '0,30' puppet complains that its not a valid
minute.
Is there a different approach in puppet for this?

Here is my class:

class cronjobs_servers {

case $hostname {

"server-vm1": {
$cronminute="15,45"
$cronminute2="0"
}
"server-vm2": {
$cronminute="0,30"
$cronminute2="10"

}


}

cron {
"generate_snapshot":
command => "/server/www-production/www.server.de/cli/
generateSnapshot.php",
user => root,
weekday => ['1-5'],
minute => $cronminute2,
hour => 22;
}
cron {
"getBroadcast":
command => "/server/www-production/www.server.de/cli/
getBroadcastFromFtp.php",
user => root,
weekday => 3,
minute => $cronminute,
hour => ['8-20'];
}
cron {
"notifyMissingVideo":
command => "/server/www-production/www.server.de/cli/
notifyMissingVideo.php",
user => root,
weekday => 3,
minute => $cronminute,
hour => ['8-20'];
}
cron {
"cache_cleanup":
command => "nice -n 19 /usr/sbin/tmpwatch -a -d -q 48 /
server/www-production/www.server.de/cache",
user => root,
minute => 2,
hour => 0;
}
}


thx a lot

.r

Macno

unread,
Jul 2, 2009, 5:11:43 AM7/2/09
to Puppet Users
You can do something like this

cron {
"getBroadcast":
command => "/server/www-production/www.server.de/cli/
getBroadcastFromFtp.php",
user => root,
weekday => 3,
minute => $hostname ? {
server-vm1 => "15,45",
server-vm2 => "0,30"
},
hour => ['8-20'];

Linux User

unread,
Jul 2, 2009, 5:21:24 AM7/2/09
to puppet...@googlegroups.com
Hello,

is still get the same error:

err: Could not create notifyMissingVideo: Parameter minute failed: 15,45 is not a valid minute at /etc/puppet/manifests/classes/cronjobs.pp:119
warning: Not using cache on failed catalog
warning: Configuration could not be instantiated: Parameter minute failed: 15,45 is not a valid minute at /etc/puppet/manifests/classes/cronjobs.pp:119


.r

Peter Meier

unread,
Jul 2, 2009, 5:50:56 AM7/2/09
to puppet...@googlegroups.com
Hi

> is still get the same error:
>
> err: Could not create notifyMissingVideo: Parameter minute failed: 15,45 is
> not a valid minute at /etc/puppet/manifests/classes/cronjobs.pp:119
> warning: Not using cache on failed catalog
> warning: Configuration could not be instantiated: Parameter minute failed:
> 15,45 is not a valid minute at /etc/puppet/manifests/classes/cronjobs.pp:119

http://reductivelabs.com/trac/puppet/wiki/TypeReference#cron clearly
states, that multiple values should be supplied as an array...

cheers pete

Joe McDonagh

unread,
Jul 4, 2009, 12:34:44 PM7/4/09
to puppet...@googlegroups.com
You can also use the '*/15' notation. I use single quotes, not sure if *
is a meta character, but better safe than sorry.

Rupert

unread,
Jul 9, 2009, 10:49:24 AM7/9/09
to puppet...@googlegroups.com

Hello,

thnx for the tips, i thought I tried the array option, but I had some quotes there, without it works fine.



.r
 



Reply all
Reply to author
Forward
0 new messages