26 lines
615 B
Bash
26 lines
615 B
Bash
# backing.sh
|
|
# ----------
|
|
#
|
|
# Compress a folder and store it in given location with a
|
|
# specific system user owner
|
|
#
|
|
# SYNOPSIS
|
|
# backing.sh [FILE] [DEST] [SRC] [OWN]
|
|
#
|
|
# by Jony Silva
|
|
# Thu 6 Aug 01:40:45 GMT 2015
|
|
# Anti-copyright and/or BeerWare.
|
|
|
|
|
|
#!/bin/bash
|
|
|
|
NOW=$(date +"%d-%m-%Y") # [NOW] The current date formated with, day/month/year
|
|
FILE="$1.$NOW.tar.bz2" # [FILE] Name of the backed up file
|
|
DEST="$2" # [DEST] Complete path to store file in
|
|
SRC="$3" # [SRC] Folder to be backed up
|
|
OWN="$4" # [OWN] Final owner of the file
|
|
|
|
|
|
tar cvfj $DEST/$FILE -C $SRC .
|
|
chown $OWN.$OWN $DEST/$FILE
|