On Thu, 3 Mar 2011 09:49:49 +0100 (CET) mark wrote: n> Sorry for the delay in replying. I've been travelling, I made a cronjob method in the standard library, so that adding cron is simple:
n> bundle agent test n> { n> methods: n> # cronjob(command,user,hours,mins) n> "cron" usebundle => cronjob("/bin/ls","mark","*","5,10"); n> "cron" usebundle => cronjob("/bin/pwd","root","*","5,10,15"); n> } n> etc. Hopefully this makes it simple. I would love to see a cron_d_job that places something in /etc/cron.d instead. That has the advantage (on RHEL and Debian/Ubuntu, don't know about the others) that no HUP to the daemon is necessary, any user can be specified in any of the files, and the /etc/cron.d files can be split up by purpose and not by user name. Something like this, perhaps. Note how much simpler it is than cronjob(). bundle agent cron_d_job(basename, command, user, hours, mins) # For adding lines to /etc/cron.d/basename crontabs for a user # methods: # "crond" usebundle => cron_d_job("markcrons", "/bin/ls","mark","*","5,10"); { vars: "crond" string => "/etc/cron.d"; files: "$(crond)/$(basename)" comment => "General batch jobs are added to $(crond)/$(basename)", create => "true", edit_line => append_if_no_line("$(mins) $(hours) * * * $(user) $(commands)"), perms => mo("644","root"); } It may be good to also add cronjob_setenv and cron_d_job_setenv to set the general environment: PATH, MAILTO, SHELL. This has been a concern of mine ever since the cfperl days so it's good to see a general way of doing it. I would agree with Seva, however, that the other cron fields should be available if the user wants to specify them. In a general library it makes sense to provide that even if cfengine can do it externally. cfengine doesn't run frequently enough in some setups. Thanks Ted _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine