diff --git a/backing.sh b/backing.sh new file mode 100644 index 0000000..0c63b9c --- /dev/null +++ b/backing.sh @@ -0,0 +1,25 @@ +# 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