iptables -A INPUT -p TCP -s [Your_IP] -j ACCEPT && iptables -A INPUT -p TCP —dport 22 -j DROP

 — 

Accept all incoming connections from [Your_IP] using TCP protocol

Category: shell one liners Tags:

/bin/pg_dump -v -v -v -Z 9 -b -Fc $DB_Name -f

 — 

Dump PostgreSQL DB

Category: shell one liners Tags:

/usr/bin/pg_restore -v -d $DB_Name -1 -Fc

 — 

Restore PostgreSQL DB.

Category: shell one liners Tags:

Git Hook - Update folder on branch Push

 — 

In order to auto-update a filesystem folder after a git pull on a specific branch, I add the following to the .git/hooks/post-receive file on the repo folder on the server:

#!/bin/sh

read oldrev newrev ref
BRANCH=`echo $ref | cut -d / -f 3-`

if [ "$BRANCH" = "<Branch_Name>" ]; then
    DIR ...
Category: posts Tags:

/usr/bin/wget —retry-connrefused —continue [url]

 — 

Fetch files using wget with resume in case of drop connection option.

Category: shell one liners Tags:

© Leon Waldman 2015

Powered by Pelican