bin/web-backup
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#!/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 |