Skip to content

Instantly share code, notes, and snippets.

Terminal:
$ brew install postgresql
/usr/local/Cellar/postgresql/9.5.2
/usr/local/var/postgres
To have launchd start postgresql now and restart at login:
$ brew services start postgresql
$ brew services stop postgresql
@ncabrerax
ncabrerax / autopgsqlbackup.sh
Created May 14, 2016 15:45 — forked from isccarrasco/autopgsqlbackup.sh
Script to automate the postgresql database backups, this script can create backups for daily, weekly and monthly for an only database or all databases, also can create crontab task for backups using hours of backups.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <[email protected]>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
#Terminar proceso en la Base de Datos
SELECT pg_terminate_backend(#pid);
SELECT * FROM pg_stat_activity WHERE datname='nombreBD';
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='nombreBD';
#Log de la Base de datos
tail -f /usr/local/var/postgres/server.log
#tamaño por tabla
@ncabrerax
ncabrerax / restart-postgresql.md
Created July 28, 2016 23:58 — forked from isccarrasco/restart-postgresql.md
Command tu stop and start the PostgreSQL on Mac OS X

pg_ctl -D /usr/local/var/postgres stop -s -m fast

pg_ctl -D /usr/local/var/postgres/ -l /usr/local/var/postgres/server.log start

@ncabrerax
ncabrerax / create-booteable-usb-on-osx.md
Created March 16, 2017 17:00
How to create a bootable USB stick on OS X
  1. Download iso
  2. Open the Terminal
  3. Convert the .iso file to .img using the convert option of hdiutil e.g.,

$ hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/distro.iso

Note: OS X tends to put the .dmg ending on the output file automatically.

  1. Run $ diskutil list