immortalize 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/immortalize +4 -5
- data/immortalize.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
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]}\" | sh & echo $!") do |f|
|
119
|
+
open("|echo \"#{@reg[:command]}\" 1>/dev/null 2>&1 | sh & echo $!") do |f|
|
120
120
|
pid = f.sysread(5).chomp.to_i
|
121
121
|
end
|
122
122
|
# Log the pid
|
@@ -164,7 +164,6 @@ end
|
|
164
164
|
|
165
165
|
# Curate the command string
|
166
166
|
if ARGV[1].to_s.length > 1 && ARGV[1] !~ /^\d+$/
|
167
|
-
puts ARGV.inspect
|
168
167
|
$command_string = ARGV[1]
|
169
168
|
# Complain about the string if it does not have proper output redirections
|
170
169
|
cmds = $command_string.split(/; ?/)
|
@@ -172,7 +171,7 @@ if ARGV[1].to_s.length > 1 && ARGV[1] !~ /^\d+$/
|
|
172
171
|
lst,out_s = last_cmd.split(/(?: \d)? ?>/,2)
|
173
172
|
cmds << lst
|
174
173
|
outs = last_cmd.scan(/(?: \d)? ?> ?\S+/)
|
175
|
-
outs = outs.map {|o| o.sub(
|
174
|
+
outs = outs.map {|o| o.sub(/^ ?> ?/,">").sub(/^>/,"1>").sub(/^ /,'') }
|
176
175
|
unless outs.any? {|o| o =~ /^2>/}
|
177
176
|
warn "Appending default STDERR redirection: 2>&1 (STDERR > STDOUT)"
|
178
177
|
outs << "2>&1"
|
@@ -195,8 +194,8 @@ unless ::Object.const_defined?(:IRB)
|
|
195
194
|
warn "Couldn't find installed version of the 'immortalize' command! (Try `which immortalize`)"
|
196
195
|
exit
|
197
196
|
end
|
198
|
-
crons.reject! {|c| c =~ /immortalize > #{$log_location}\/cron.log
|
199
|
-
crons << "* * * * * #{immortalize_cmd} > #{$log_location}/cron.log\n"
|
197
|
+
crons.reject! {|c| c =~ /immortalize > #{$log_location}\/cron.log/}
|
198
|
+
crons << "* * * * * #{immortalize_cmd} > #{$log_location}/cron.log 2>&1\n"
|
200
199
|
puts "Installing crons:\n\t#{crons.join("\n\t")}"
|
201
200
|
f = IO.popen("crontab -", 'w')
|
202
201
|
f << crons.join("\n")
|
data/immortalize.gemspec
CHANGED