Skip to content

Instantly share code, notes, and snippets.

View jmfederico's full-sized avatar

Federico Jaramillo Martínez jmfederico

View GitHub Profile
@jmfederico
jmfederico / Makefile
Last active July 10, 2020 11:04
An awsome Makefile
# On OSX the PATH variable isn't exported unless "SHELL" is also set, see: http://stackoverflow.com/a/25506676
SHELL = /bin/zsh
.DEFAULT_GOAL := help
TMPDIR := $(shell mktemp -d)
include .env
INTRO = "\n\e[33m------------------------------\e[32m\n$@\n\e[33m------------------------------\e[39m\n"
help: ## Prints this message
@jmfederico
jmfederico / run-xtrabackup.sh
Last active February 6, 2024 08:52
Script to create full/incremental backups with xtrabackup.
#!/bin/sh
TMPFILE="/tmp/xtrabackup-runner.$$.tmp"
USEROPTIONS="--user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --host=${MYSQL_HOST}"
BACKDIR=/srv/mysql-bak
BASEBACKDIR=$BACKDIR/base
INCRBACKDIR=$BACKDIR/incr
FULLBACKUPCYCLE=604800 # Create a new full backup every X seconds
KEEP=1 # Number of additional backups cycles a backup should kept for.
START=`date +%s`
@jmfederico
jmfederico / backups.sh
Last active September 24, 2015 22:58
MySQL quick commands!
# BackUp
mysqldump --opt --password=miclave --user=miuser mibasededatos > archivo.sql
# BackUp to bz2
mysqldump --opt --password=miclave --user=miuser mibasededatos | bzip2 -c > archivo.sql.bz2