From 8c91b846a746c5062b49fc267a4ae60459ae6883 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Thu, 7 Dec 2023 13:05:23 +0100 Subject: [PATCH] cron added --- lib.cf | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib.cf b/lib.cf index a7e4469..9a39bc7 100644 --- a/lib.cf +++ b/lib.cf @@ -408,3 +408,33 @@ files: classes => results("namespace","etc_hosts"); } + +bundle agent cron +{ +vars: + "cron_d" string => "/etc/cron.d"; + freebsd:: + "cron_d" string => "/usr/local/etc/cron.d"; +files: + "$(cron_d)/." + create => "true", + handle => "cron_d_created"; + +} + +bundle agent create_cron_job(name,time,command) +{ +methods: + "any" usebundle => cron; +files: + "$(cron.cron_d)/$(name)" + create => "true", + content => "# +# Managed by CFEngin +# + +$(time) $(command) +", + depends_on => {"cron_d_created"}; +} +