Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional reboot #144

Closed
rippiedoos opened this issue Apr 25, 2018 · 3 comments
Closed

Conditional reboot #144

rippiedoos opened this issue Apr 25, 2018 · 3 comments
Assignees
Labels
Enhancement Feature requests and existing code improvements

Comments

@rippiedoos
Copy link

From my point of view, a conditional reboot with a configurable package list should be nice. At this point, if AUTOREBOOT=yes, the system reboots if ANY package is updated.

Last night, the system was rebooted because dehydrated RPM was updated.

It would be nice if the system reboots only if a package in some list is updated. For instance, only reboot if glibc*, libstd* or kernel* is updated. The rest is restarted automatically during package update.

Maybe an introduction of a third value for AUTOREBOOT=(yes|no|conditional) and a parameter
AUTOREBOOT_ON_PACKAGES="kernel glibc libstd" which would be a matching list would be nice.

@reaperzn
Copy link
Contributor

reaperzn commented May 2, 2018

Hi @rippiedoos

Thanks for raising this. There are a lot of considerations that need to be taken into account when assessing if a server needs to be rebooted after updates. There is not a hard and fast generic way of making this assessment. There is a script in yum-utils which attempts to do this however even with this script, there may be some conditions which are missed based on the setup of the server.

With that in mind, this is not something we would likely build directly into auter however this may be something easily achievable using a post-apply script.

I would recommend something along the lines of this for a RHEL server:

/etc/auter/post-apply.d/01-conditional-reboot.sh

#!/bin/bash

[[ -f /usr/bin/needs-restarting ]] && RUNNING_UPDATED_SERVICES="$(/usr/bin/needs-restarting)"
[[ -n ${RUNNING_UPDATED_SERVICES} ]] && echo "auter --reboot" | at now +1 minute

You can define any conditions you want in the script however I would highly recommend using the echo "auter --reboot" | at now +1 minute as the reboot command to ensure that:

  1. the current auter process can complete (Assuming AUTOREBOOT=no the only thing left is some logging)
  2. If there are any pre/post reboot scripts, they will also be executed.

@reaperzn reaperzn self-assigned this May 2, 2018
@reaperzn reaperzn added Enhancement Feature requests and existing code improvements Contrib Issues and PRs for the contrib directory and removed Contrib Issues and PRs for the contrib directory labels May 2, 2018
@reaperzn
Copy link
Contributor

@rippiedoos I have created a contrib script in #152

You are welcome to test and use that. You can add that as a post-apply script. If you do use that then remember to set AUTOREBOOT=no in your auter.conf file.

If possible please do test it out and let me know your thoughts.

@rippiedoos
Copy link
Author

Thanks for the contrib script! Works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Feature requests and existing code improvements
Projects
None yet
Development

No branches or pull requests

2 participants