modules/mu/mommacat.rb in cloud-mu-3.0.1 vs modules/mu/mommacat.rb in cloud-mu-3.0.2
- old
+ new
@@ -2760,10 +2760,13 @@
end
# Start the Momma Cat daemon and return the exit status of the command used
# @return [Integer]
def self.start
+ if MU.inGem? and MU.muCfg['disable_mommacat']
+ return
+ end
base = (Process.uid == 0 and !MU.localOnly) ? "/var" : MU.dataDir
[base, "#{base}/log", "#{base}/run"].each { |dir|
if !Dir.exist?(dir)
MU.log "Creating #{dir}"
Dir.mkdir(dir)
@@ -2782,24 +2785,23 @@
cmd = %Q{bundle exec thin --threaded --daemonize --port #{MU.mommaCatPort} --pid #{daemonPidFile} --log #{daemonLogFile} --ssl --ssl-key-file #{MU.muCfg['ssl']['key']} --ssl-cert-file #{MU.muCfg['ssl']['cert']} --ssl-disable-verify --tag mu-momma-cat -R mommacat.ru start}
end
MU.log cmd, MU::NOTICE
- output = %x{#{cmd}}
-
- Dir.chdir(origdir)
-
retries = 0
begin
+ output = %x{#{cmd}}
sleep 1
retries += 1
if retries >= 10
- MU.log "MommaCat failed to start (command was #{cmd})", MU::WARN, details: output
+ MU.log "MommaCat failed to start (command was #{cmd}, working directory #{MU.myRoot}/modules)", MU::WARN, details: output
pp caller
return $?.exitstatus
end
end while !status
+
+ Dir.chdir(origdir)
if $?.exitstatus != 0
exit 1
end
@@ -2807,9 +2809,12 @@
end
# Return true if the Momma Cat daemon appears to be running
# @return [Boolean]
def self.status
+ if MU.inGem? and MU.muCfg['disable_mommacat']
+ return true
+ end
if File.exist?(daemonPidFile)
pid = File.read(daemonPidFile).chomp.to_i
begin
Process.getpgid(pid)
MU.log "Momma Cat running with pid #{pid.to_s}"