From: Jeff Peng Date: 2010-02-06T18:25:31+09:00 Subject: Re: Can ruby do a repeated Reboot test script 在 2010-02-06六的 17:52 +0900,Ham Baba写道: > Just want to write a ruby script that reboots the computer for 10 > repeated times. Is it possible? I appriciate any help. You may want to write a status file for the rebooting count. For example: rcdFile="/tmp/reboot.rcd" times = 0 if File.file? rcdFile File.open(rcdFile) do |f| times = f.read.to_i end else File.open(rcdFile,"w") do |f| f.write(times) end end times += 1 File.open(rcdFile,"w") do |f| f.write(times) end if times <= 10 system("reboot") end Then run this script from crontab or system init scripts. HTH. -- Jeff Peng Email: jeffpeng@netzero.net Skype: compuperson