-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
executable file
·62 lines (53 loc) · 1.16 KB
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env ruby
# encoding: utf-8
load './log.rb'
$log = Log.new
Thread.new {
while true
comp = Time.new
$log.write
if $log.tname.day != comp.day
$log.logger("Start changing LogFile!")
$log.write
$log.update_file
$log.logger("LogFile have changed! A brand new day comes!")
end
sleep 30
end
}
def quit(*mesg)
@mesg = mesg
@mesg = @mesg.join "\n"
$log.logger @mesg
$log.write
exit
end
trap("TERM") do
print "\n"
quit "I need to go because system going down."
end
trap("INT") do
print "\n"
quit "Forced Shutdown by ctrl-c."
end
require './gen.rb'
if !File.exist?("setting.rb")
gen = Gen.new
gen.getSetting
gen.writeSetting
end
require './setting.rb'
require './plurk.rb'
require './terminal.rb'
$plurk = Plurk.new(keys[:apk], keys[:aps])
$plurk.authorize(keys[:act], keys[:acs])
begin
unless ARGV[0]
terminal = Terminal.new
terminal.console
end
rescue
puts "Unhandled Error Occured : " + $!.to_s
puts "Check the logfile for more Information!!!"
quit "Error: " + $!.to_s,"Backtrace: ",$@
end