All pastes #948473 Raw Edit

Someone

public ruby v1 · immutable
·published 2008-03-19 04:12 UTC
rendered paste body
#!/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"subject = "UPDATE NOTICE"emailHeader = <<END_OF_MESSAGEFrom: <#{from}>To: <#{to}>Subject: <#{subject}>Content-Type: text/plain; charset="UTF-8"Here are the results of udatenotice.rbEND_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)                myMessage = "#{emailHeader}\n #{updates}\n #{emailFooter}\n"                Net::SMTP.start('localhost') do |smtp|                        smtp.send_message myMessage, from, to                end        endend