aboutsummaryrefslogtreecommitdiff
path: root/manifests/reboot_required_notify.pp
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-12-11 14:43:24 +0100
committerintrigeri <intrigeri@boum.org>2010-12-11 14:50:16 +0100
commit874da52745d7f9c34976a9e05292a92bb449e803 (patch)
tree9c0b7bcbeb46e7f6c5a97531be2cc49f65671727 /manifests/reboot_required_notify.pp
parentb467cda7f44165743ed7409ff19894052fc85b9e (diff)
downloadpuppet-apt-874da52745d7f9c34976a9e05292a92bb449e803.tar.gz
puppet-apt-874da52745d7f9c34976a9e05292a92bb449e803.tar.bz2
New class: apt::reboot_required_notify
This class installs a daily cronjob that checks if a package upgrade requires the system to be rebooted; if so, cron sends a notification email to root.
Diffstat (limited to 'manifests/reboot_required_notify.pp')
-rw-r--r--manifests/reboot_required_notify.pp20
1 files changed, 20 insertions, 0 deletions
diff --git a/manifests/reboot_required_notify.pp b/manifests/reboot_required_notify.pp
new file mode 100644
index 0000000..3c6db79
--- /dev/null
+++ b/manifests/reboot_required_notify.pp
@@ -0,0 +1,20 @@
+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
+ # 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 => 4,
+ minute => 20,
+ require => Package['update-notifier-common'],
+ }
+
+}