Preface
=======

This tool currently supports OpenRC and systemd init systems.

What is this?
=============

After upgrading packages there will be services that need to be restarted most
of the time.

You have different choices now:
* reboot your system (maybe you don't want that)
* manually search for upgraded services and restart all of them one by one
* use something like the 'lib_users' tool to find processes using deleted 
  files and try to spot which of them are services that need to be restarted.

I found all of the above options to be too timeconsuming or inconvenient.
So i created another option:

  restart-services

This tool depends on 'lib_users' and will find out which services need to 
be restarted and restarts them if you want.

And as there are services which you can restart all day and night without any
service disruption there are other services which you only want to see restarted
at night when nobody is using them.

So 'restart-services' can be configured in a way so that it will know which services
can be restarted always, never, or only if you tell it to do so explicitely.

Getting started
===============

* $EDITOR /etc/restart-services.d/00-local.conf
* restart-services --help

Using restart-services
======================

You can categorize all you services in the configuration file.

After upgrading your system, run 'restart-services -l' and it will show you all
services that need to be restarted.

By running 'restart-services' without any options it will restart everything
that must be restarted and is configured as "can always be restarted"

Then, at night, you can restart the rest using 'restart-services --critical'

Another option might be to configure it as a hook for emerge, e.g. something like that:

 /etc/portage/bashrc:
 if [ "${EBUILD_PHASE}" == "postinst" ]; then
   restart-services
 fi

Or maybe if you just want them listed:

 /etc/portage/bashrc:
 if [ "${EBUILD_PHASE}" == "postinst" ]; then
   echo "Services that need to be restarted:"
   restart-services -l
 fi

Note for SELinux users
======================
As restart-services uses 'run_init' to call init scripts on SELinux-enabled
systems it is adviced to enable the line

  'auth       sufficient   pam_rootok.so'

in

  '/etc/pam.d/run_init'

as adviced in Gentoo SELinux FAQ on [1]

Otherwise you will be prompted for the root password for every single service to be restarted.
As an alternative it may work to run restart-services itself as 'run_init restart-services' when
it is labeled accordingly

Advanced configuration
======================

You can use any of the long command line options as configuration parameters in
the config file. Just write them in UPPER case and replace dashes by underscores.

Example: If you want to make "--no-countdown" the default, just add "NO_COUNTDOWN=1"
to the configuration file.

Links
=====
[1] https://wiki.gentoo.org/wiki/SELinux/FAQ#Why_do_I_always_need_to_re-authenticate_when_operating_init_scripts.3F

# EOF
