Sha256: cc17a6d4d8cb8d2dd96c8997aa5cb101c3d334a8daf16f5ca3793d55b218cfca

Contents?: true

Size: 784 Bytes

Versions: 26

Compression:

Stored size: 784 Bytes

Contents

#!/usr/bin/env ruby
# Finds the latest Passenger crash log directory and prints its path.
# This tool is meant to make it easy to analyze local Passenger crash
# logs during debugging sessions. Instead of searching for the crash
# log directory path in the output and then copy-pasting that to the
# terminal, one can simply invoke one shell command:
#
#   less $(./dev/show-latest-crashlog-dir)/backtrace.log
#
# This will open the latest crash log's backtrace.log in 'less'.

def parse_path(path)
  File.basename(path).split('.')[1].to_i
end

def main
  dirs = Dir["/var/tmp/passenger-crash-log.*.*"].sort do |a, b|
    parse_path(a) <=> parse_path(b)
  end
  if dirs.empty?
    abort "No /var/tmp/passenger-crash-log.* directories found."
  else
    puts dirs.last
  end
end

main

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
passenger-6.0.24 dev/show-latest-crashlog-dir
passenger-6.0.23 dev/show-latest-crashlog-dir
passenger-6.0.20 dev/show-latest-crashlog-dir
passenger-6.0.19 dev/show-latest-crashlog-dir
passenger-6.0.18 dev/show-latest-crashlog-dir
passenger-6.0.17 dev/show-latest-crashlog-dir
passenger-6.0.16 dev/show-latest-crashlog-dir
passenger-6.0.15 dev/show-latest-crashlog-dir
passenger-6.0.14 dev/show-latest-crashlog-dir
passenger-6.0.13 dev/show-latest-crashlog-dir
passenger-6.0.12 dev/show-latest-crashlog-dir
passenger-6.0.11 dev/show-latest-crashlog-dir
passenger-6.0.10 dev/show-latest-crashlog-dir
passenger-6.0.9 dev/show-latest-crashlog-dir
passenger-6.0.8 dev/show-latest-crashlog-dir
passenger-6.0.7 dev/show-latest-crashlog-dir
passenger-6.0.6 dev/show-latest-crashlog-dir
passenger-6.0.5 dev/show-latest-crashlog-dir
passenger-6.0.4 dev/show-latest-crashlog-dir
passenger-6.0.3 dev/show-latest-crashlog-dir