#!/usr/bin/ruby# updatenotice.rb#### This is a Ruby script meant to run in a cron on a Gentoo system.#### The goal of this script is to email available portage updates to the system administrator##from = "scripts@hackdmz.net"to = "magari@hackdmz.net"emailheader = <<END_OF_MESSAGEFrom: Scripts <#{$from}>To: Magari <#{$to}>Subject: Update NoticeEND_OF_MESSAGEemailfooter = <<END_OF_MESSAGE--- SCRIPTS @ HACKDMZ ---END_OF_MESSAGE###### DONT EDIT PAST THIS LINE####require 'net/smtp'sync = %x[emerge --sync]if ($? == 0) updates = %x[emerge -uDpv world] if ($? == 0) message = "#{emailheader} #{updates} #{emailfooter}\n" Net::SMTP.start('localhost') do |smtp| smtp.send_message message, from, to end endend