Skip to content

Instantly share code, notes, and snippets.

@mitnk
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitnk/933c9b30709cb0d4828c to your computer and use it in GitHub Desktop.
Save mitnk/933c9b30709cb0d4828c to your computer and use it in GitHub Desktop.
Tailf lastest PostgreSQL Log
path=`ps ax | grep -i 'postmaster' | grep -o '\-D\(/Library/Post.*\)' | awk -F D '{print $NF}'`
log_dir="${path}/pg_log"
log_name=`sudo ls -1t ${log_dir} | head -n1`
log_file="${log_dir}/${log_name}"
echo ""
echo "=========== $log_file =========="
echo ""
sudo tail -f "$log_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment