Closed ThomBell closed 5 years ago
The contrib scripts are more of a recommendation and should be customised depending on your situation. If you're running patching once per month you could always remove the -%d
from the tag from each of the scripts.
Hi @ThomBell,
Thanks for pointing this out however please note that this situation has been specifically highlighted in the "Configsnap options used" section of the configsnap readme (https://github.com/rackerlabs/auter/blob/master/contrib/configsnap/README.md)
As stated int the main contrib readme (See the Warning section of https://github.com/rackerlabs/auter/blob/master/contrib/README.md) these scripts are provided as-is and should be reviewed before implementing.
To address your issue, there are a few options available:
1) As @nrhodes91 pointed out, if you are running auter on a monthly schedule then you could simply use a different date format ie: -t auter-configsnap-"$(date +%Y-%m)"
2) You could use a more generic tag like -t auter-configsnap
and create an additional postscript (to be run as the last script of the last stage of your patching plan ie: post-reboot.d) to rename that configsnap directory to include a date ie:
/etc/auter/post-reboot.d/99-rename-configsnap-dir.sh:
#!/bin/bash
mv /root/auter-configsnap /root/auter-configsnap-"$(date +%Y-%m-%d)"
The contrib scripts are provided as a guideline and example however should always be reviewed and adjusted according to your specific requirements. If you do have any ideas for improvements we would be happy to discuss them but we also welcome any contributions via pull requests.
Just to continue with the suggestions - an option I looked into the other day would be to run the following cron job:
0 23 1-7 * Sat root RUN="first" /usr/bin/auter --apply
0 23 8-15 * Sat root RUN="second" /usr/bin/auter --apply
And then use $RUN
in the configsnap pre/post scripts -t auter-configsnap-"$(date +%Y-%m)-$RUN"
.
Closing this out as the contrib scripts should be altered for each Auter deployment and are there as a guide.
The 01-configsnap-pre, 50-configsnap-post-apply, 50-configsnap-pre-reboot, 99-configsnap-post-reboot all use $(date +%Y-%m-%d) to create a directory to store results to be compared at a later time. This does not account for the pre script being run prior to midnight and the post script being run after midnight, for example if you set the start time to 23:58 and the update process does not finish until some point after 00:00. In this situation the post script cannot locate the directory the pre script created earlier as the date command will return the next days date instead of the date the pre script was run on.