Why not set the class in the files promise?
M
Matt Richards wrote:
> Greetings,
>
> I am trying to add a line to cron and have it restart cron if the
> crontab file is updated. This example is very similar to the example
> in the manual. The line is indeed added to the crontab, but the
> "restart_cron" class does not activate in the processes section.
>
> files:
>
> "/var/spool/cron/crontabs/root"
> edit_line => cron_cfexecd;
>
> processes:
>
> restart_cron::
> "cron" signals => { "hup" };
>
>
> ##########################################################################
>
> bundle edit_line cron_cfexecd {
>
> classes:
>
> "restart_cron" not => regline(".*cf-execd.*","$(edit.filename)");
>
> insert_lines:
>
> restart_cron::
>
> "0 1 * * * $(sys.workdir)/bin/cf-execd -F > /dev/null 2>&1 ";
>
> }
>
> ##########################################################################
>
>
> Now we run it.....
>
> cf3 = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> cf3 classes in bundle cron_cfexecd
> cf3 = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> cf3
> cf3 ?? Private class context
> cf3 ?? restart_cron
> cf3
> cf3
> cf3 = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> cf3 insert_lines in bundle cron_cfexecd
> cf3 = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> cf3
> cf3 -> Promised line "0 1 * * * /var/cfengine/bin/cf-execd -F >
> /dev/null 2>&1 " exists within selected region of
> /var/spool/cron/crontabs/root (promise kept)
> cf3 -> Saving edit changes to file /var/spool/cron/crontabs/root
> cf3 Edited file /var/spool/cron/crontabs/root
> cf3 -> Copy of regular file succeeded
> /var/spool/cron/crontabs/root.cf-before-edit to
> /var/cfengine/backup/_var_spool_cron_crontabs_root.cf-before-edit.cfnew
> cf3 Moved /var/spool/cron/crontabs/root.cf-before-edit to repository
> location /var/cfengine/backup/_var_spool_cron_crontabs_root.cf-before-edit
>
>
> so far so good, it was added and restart_cron was set privately. But
> back to the processes line:
>
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> cf3 Skipping whole next promise (cron), as context restart_cron is not
> relevant
> cf3 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> _______________________________________________
> Bug-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-cfengine
--
Mark Burgess
-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway
Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine