Forum: Cfengine Help Subject: How does edit_backup => "rotate" work? Author: zzamboni Link to topic: https://cfengine.com/forum/read.php?3,19393,19393#msg-19393
Howdy, Somehow I had never tried edit_backup => "rotate" before (I always used "timestamp"), and maybe I'm being dense, but I don't think it's working properly. Here is a self-contained sample policy: body common control { bundlesequence => { "editexample" }; inputs => { "cfengine_stdlib.cf" }; } bundle agent editexample { files: "c:/cygwin/etc/motd" edit_line => insert_lines("Unauthorized use will be prosecuted"), edit_defaults => rotate; } body edit_defaults rotate { empty_file_before_editing => "false"; edit_backup => "rotate"; rotate => "4"; max_file_size => "300000"; } Now, when I run it: $ cat /etc/motd Welcome to the system. $ ls /etc/motd* /etc/motd $ cf-agent.exe -KI -f ./fileedit_example.cf -> Edited file c:/cygwin/etc/motd $ cat /etc/motd Welcome to the system. Unauthorized use will be prosecuted $ ls /etc/motd* /etc/motd /etc/motd.cf-before-edit $ sed -i -e 's/prosecuted/frowned upon/' /etc/motd $ cat /etc/motd Welcome to the system. Unauthorized use will be frowned upon $ cf-agent.exe -KI -f ./fileedit_example.cf -> Edited file c:/cygwin/etc/motd $ ls /etc/motd /etc/motd /etc/motd.cf-before-edit $ cat /etc/motd Welcome to the system. Unauthorized use will be frowned upon Unauthorized use will be prosecuted $ cat /etc/motd.cf-before-edit Welcome to the system. Unauthorized use will be frowned upon As you can see, the behavior doesn't change from the default - it is just making one backup copy of the file, without rotation. Am I doing something wrong, or is this broken? I'm using Nova 2.0 on Windows. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine