Works ok for me
Steve Barnes wrote:
> I'm trying to disable a few cron tasks by inserting an `exit 0` statement
> just after the shebang:
>
> ###################################################
>
> bundle agent cron {
>
> files:
>
> "/etc/cron.daily/mlocate.cron"
>
> edit_line => disable_task;
>
> "/etc/cron.daily/makewhatis.cron"
>
> edit_line => disable_task;
>
> "/etc/cron.weekly/makewhatis.cron"
>
> edit_line => disable_task;
>
> }
>
> bundle edit_line disable_task {
>
> insert_lines:
>
> "exit 0"
>
> location => after_shebang;
>
> }
>
> body location after_shebang {
>
> select_line_matching => "^#!.*sh$";
> before_after => "after";
>
> }
>
> ###################################################
>
> What I end up with in all of the files is this:
>
> [r...@box]# cat /etc/cron.daily/mlocate.cron
> #!/bin/sh
> nodevs=$(< /proc/filesystems awk '$1 == "nodev" { print $2 }')
> renice +19 -p $$ >/dev/null 2>&1
> /usr/bin/updatedb -f "$nodevs"
> exit 0
> exit 0
> exit 0
>
> If I modify the promise to use `before_after => "before";` it does what I
> would expect:
>
> [r...@box]# cat /etc/cron.daily/mlocate.cron
> exit 0
> #!/bin/sh
> nodevs=$(< /proc/filesystems awk '$1 == "nodev" { print $2 }')
> renice +19 -p $$ >/dev/null 2>&1
> /usr/bin/updatedb -f "$nodevs"
> exit 0
>
> But that's not what I'm after. Is this a bug?
>
> Cheers
>
> Steve
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-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
-------------------------------------------------
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine