clearlinux/clr-service-restart

Name: clr-service-restart

Owner: Clear Linux* Project for Intel Architecture

Description: Automatically restart system services that need restarting after software updates.

Created: 2018-01-16 17:41:58.0

Updated: 2018-04-30 09:33:31.0

Pushed: 2018-02-15 18:24:18.0

Homepage: null

Size: 43

Language: C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

clr-service-restart

A program that restarts systemd services that are using software components that have been updated.

How it works

The Linux kernel maintains information about running processes in the procfs filesystem. This information can be used to identify processes that are using resources that are no longer physically present on the file system, such as when a binary or system library is updated.

Any software update causes the kernel to see that a reference to a binary or a reference to a library is no longer corresponding with the actual current version of the library or binary on the filesystem. If this happens, the kernel will mark the procfs entries for those references as (deleted). Specifically the exe symlink will get marked in this way if the binary is updated, and the maps file will get updated in this way if a library component is updated.

Using these references, we now know which programs are currently being executed that are holding references to outdated libraries or binaries, and therefore should be restarted.

However, we do not want to restart programs that are not part of a system unit, or in some other way are not part of the system domain. In order to avoid considering all processes running for the purpose of restarting them, we restrict consideration to only those processes that are listed as active tasks in the systemd system.slice hierarchy maintained under /sys/fs/cgroup/systemd/. This hierarchy only contains units (and therefore tasks) in the system domain and excludes user units or user programs.

Configuration

It's extremely risky to restart all units unconditionally since some units may require specific ordering, interaction or other factors to be considered. By default, this program will not restart any service automatically, and will only consider units that have been explicitly marked as allowed by either the local administrator or the distribution. This is done through maintaining symlinks in /usr/share/clr-service-restart and /etc/clr-service-restart. If a valid symlink is found in these folders, the unit will be considered for restarting. If a symlink is found in /etc/clr-service-restart with the name of a unit pointing to /dev/null it will be omitted for consideration and not be restarted. Links in the /etc/clr-service-restart location take precedence over those in /usr/share/clr-service-restart. Links to /dev/null in the /usr/share/clr-service-restart location are invalid.

Commands

These symlinks can be manipulated by the local administrator with the clr-service-restart program, which understands the following 3 commands:

If clr-service-restart is executed without any commands, it will restart all services that are marked allow for restart.

Options

The following options are understood. These options may not be used together with the allow, disallow and default commands.

Bugs

Please report bugs to: dev@lists.clearlinux.org

License

Copyright © 2018 Intel Corporation

Author: Auke-jan H. Kok <auke-jan.h.kok@intel.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.