immortalize 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/immortalize +7 -7
- data/immortalize.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/bin/immortalize
CHANGED
@@ -116,7 +116,7 @@ class Immortal
|
|
116
116
|
def start!
|
117
117
|
# Run the command and gather the pid
|
118
118
|
pid = nil
|
119
|
-
open("|echo \"#{@reg[:command]}\" 1>/dev/null 2>&1
|
119
|
+
open("|echo \"#{@reg[:command]}\" 1>/dev/null 2>&1 & echo $!") do |f|
|
120
120
|
pid = f.sysread(5).chomp.to_i
|
121
121
|
end
|
122
122
|
# Log the pid
|
@@ -170,14 +170,14 @@ if ARGV[1].to_s.length > 1 && ARGV[1] !~ /^\d+$/
|
|
170
170
|
last_cmd = cmds.pop
|
171
171
|
lst,out_s = last_cmd.split(/(?: \d)? ?>/,2)
|
172
172
|
cmds << lst
|
173
|
-
outs = last_cmd.scan(/(?: \d)?
|
174
|
-
outs = outs.map {|o| o.sub(/^
|
173
|
+
outs = last_cmd.scan(/(?: \d)? ?>>? ?\S+/)
|
174
|
+
outs = outs.map {|o| o.sub(/^ ?(>>)? ?/,"\\1").sub(/^>/,"1>").sub(/^ /,'') }
|
175
175
|
unless outs.any? {|o| o =~ /^2>/}
|
176
176
|
warn "Appending default STDERR redirection: 2>&1 (STDERR > STDOUT)"
|
177
177
|
outs << "2>&1"
|
178
178
|
end
|
179
|
-
unless outs.any? {|o| o =~ /^1
|
180
|
-
warn "#{$command_string}\nInvalid command: You need to add proper STDOUT redirection, ex:
|
179
|
+
unless outs.any? {|o| o =~ /^1>/}
|
180
|
+
warn "#{$command_string}\nInvalid command: You need to add proper STDOUT redirection, ex: >/dev/null or 1>log/run.log"
|
181
181
|
exit
|
182
182
|
end
|
183
183
|
$command_string = cmds.join('; ') + ' ' + outs.join(' ')
|
@@ -194,8 +194,8 @@ unless ::Object.const_defined?(:IRB)
|
|
194
194
|
warn "Couldn't find installed version of the 'immortalize' command! (Try `which immortalize`)"
|
195
195
|
exit
|
196
196
|
end
|
197
|
-
crons.reject! {|c| c =~ /immortalize
|
198
|
-
crons << "* * * * * #{immortalize_cmd}
|
197
|
+
crons.reject! {|c| c =~ /immortalize >> #{$log_location}\/cron.log/}
|
198
|
+
crons << "* * * * * #{immortalize_cmd} >> #{$log_location}/cron.log 2>&1\n"
|
199
199
|
puts "Installing crons:\n\t#{crons.join("\n\t")}"
|
200
200
|
f = IO.popen("crontab -", 'w')
|
201
201
|
f << crons.join("\n")
|
data/immortalize.gemspec
CHANGED