長い計算ジョブの終わりを知るために、IPMessenger というアプリケーションに
メッセージを送るスクリプトを書いてみました。
これを拡張して ruby/tk と組み合わせれば使えるアプリケーションになるかな?

#!/usr/local/bin/ruby
#
# sendipm.rb
#

require "socket"
require "kconv"

class IPMSG
	IPMSG_PORT = 2425
	VERSION    = "1"
	COMMAND    = "32"

	def initialize(user, port = IPMSG_PORT)
		@user = user
		@port = port
		@sock = UDPsocket.new
	end
	def IPMSG.usage
		print "usage:  sendipmsg -e msg HOSTNAME \n",
			"        sendipmsg HOSTNAME msgfile\n",
			"        sendipmsg HOSTNAME < msgfile\n",
			"        (msgfile must be in Shift-JIS)\n"
	end
	def send(target, msg)
		s = VERSION + ":" + 
			rand(100).to_s + ":" + 
			target + ":" + 
			@user + ":" +
			COMMAND + ":" + Kconv.kconv(msg, Kconv::SJIS)
		@sock.send s, 0, target, @port
	end
end

#----------------------------------------------------------------

while ARGV.length
	if ARGV[0] =~ /^-e/
		ARGV.shift
		msg  = ARGV.shift
	else
		target = ARGV.shift
		break
	end
end

if target == nil then
	IPMSG.usage
	exit
end

if msg == nil then
	$/ = nil
	msg = gets
end

user = `whoami`
user.chop!

ipmsg = IPMSG.new(user)
ipmsg.send  target, msg

--
 有馬 康弘 <fit0298 / fitec.co.jp>