dotfiles/bin/web-backup

17 lines
518 B
Bash
Executable File

#!/usr/bin/env bash
# web-backup.sh: tar backup web directory on a server w/ date-time in name
# by x1phosura
# path to web directory to backup (CHANGE ME if different webserver!!!)
# vvv- below for FreeBSD webserver
WEBDIR=/usr/local/www/nginx
BACKUPDIR=~/web-backups
if [ $# -ne 1 ] ; then # if 0 or >1 command line args
sudo tar -cvzf $BACKUPDIR/webdir-$(date +"%F%N").tar.gz $WEBDIR
else # if 1 command line arg
sudo tar -cvzf $BACKUPDIR/webdir-$(date +"%F%N").tar.gz $1
fi