summaryrefslogtreecommitdiff
path: root/manifests/reboot_required_notify.pp
blob: 722e8a5ed9e123c487c35da0ac5f04f4239fc7b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class apt::reboot_required_notify {

  # This package installs the script that created /var/run/reboot-required*.
  # This script (/usr/share/update-notifier/notify-reboot-required) is
  # triggered e.g. by kernel packages.
  package { 'update-notifier-common':
    ensure => installed,
  }

  # cron-apt defaults to run every night at 4 o'clock
  # plus some random time <1h.
  # so we check if a reboot is required a bit later.
  cron { 'apt_reboot_required_notify':
    command => 'if [ -f /var/run/reboot-required ]; then echo "Reboot required\n" ; cat /var/run/reboot-required.pkgs ; fi',
    user    => root,
    hour    => 5,
    minute  => 20,
    require => Package['update-notifier-common'],
  }

}