diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2019-03-06 18:58:31 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2019-03-06 18:58:31 -0500 |
| commit | a288ef238f373f07271184d5a88a9bb0549a1d00 (patch) | |
| tree | 0460a8d3112be6221bdbc67b09b3498b81f67220 | |
| parent | fc65c2b1fce9aca00658734c287b5e71971e5a5c (diff) | |
| download | dotfiles-a288ef238f373f07271184d5a88a9bb0549a1d00.tar.gz dotfiles-a288ef238f373f07271184d5a88a9bb0549a1d00.tar.xz | |
Remove my old and unused backup script
| -rw-r--r-- | backup.sh | 46 | ||||
| l--------- | backup.sh.txt | 1 |
2 files changed, 0 insertions, 47 deletions
diff --git a/backup.sh b/backup.sh deleted file mode 100644 index 1f0334e..0000000 --- a/backup.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# Backup script in less than 50 lines -_dir="/backups/servers" hostname="" ssh_opts="" rsync_opts="" log=0 _pth="" _exc="exclude" -logdir="/var/log/backups" log_fmt="+%m.%d.%y_.%H.%M.%S" -if [ -z $_dir ] ; then - echo "You need to setup a base backup directory" -fi -while [ $# -gt 0 ] ; do case $1 in - -h) hostname="$2"; shift; shift; ;; - -n) rsync_opts="${rsync_opts}n"; shift; ;; - -l) log=1; shift; ;; -lt) log=2; shift; ;; - -e) _exc="$2"; shift; shift; ;; - -p) _pth="$2"; shift; shift; ;; - *) echo "Unknown option: $1"; exit 1; shift; ;; -esac done -if [ -z $hostname ] ; then - echo "Yo, you need to set a hostname"; exit 1; -fi -files="exclude key" -for _file in $files ; do - if ! [ -f $_dir/$hostname/$_file ] ; then - echo "Can't find file: $_dir/$hostname/$_file"; exit 1; - fi -done -directories="content" -for _directory in $directories ; do - if ! [ -d $_dir/$hostname/$_directory ] ; then - echo "Can't find dir: $_dir/$hostname/$_directory"; exit 1; - fi -done -if [ -e $_dir/$hostname/cfg ] ; then . $_dir/$hostname/cfg; fi -if ! [ -d $logdir ] ; then mkdir $logdir ; fi - -log_file="$logdir/${hostname}.$(date $log_fmt).log" -if ! [ -z $_pth ] ; then log_file="$logdir/${hostname}.$_pth.$(date $log_fmt).log" ; fi -backup() { - rsync -avzHP$rsync_opts --numeric-ids --delete --exclude-from="$_dir/$hostname/$_exc" \ - -e "ssh -i $_dir/$hostname/key $ssh_opts" "root@$hostname:/$_pth" "$_dir/$hostname/content/$_pth"; -} -if [ $log -eq 2 ] ; then - backup | tee $log_file; -elif [ $log -eq 1 ] ; then - backup >> $log_file; -else - backup; -fi diff --git a/backup.sh.txt b/backup.sh.txt deleted file mode 120000 index 86149be..0000000 --- a/backup.sh.txt +++ /dev/null @@ -1 +0,0 @@ -backup.sh
\ No newline at end of file |
