dotfile backups

backup script

#!/bin/bash
# date for backup file names
logdate=`date '+%y-%m-%d'`
machine=$(hostname)
runuser=$(whoami)
daynumber=$(date +%j)

echo $logdate
echo $machine
echo $runuser
echo $daynumber

# setup folders
mkdir ~/dotfiles/backups/$machine 
mkdir ~/dotfiles/backups/$machine/$daynumber
mkdir ~/dotfiles/backups/$machine/$daynumber/bash
mkdir ~/dotfiles/backups/$machine/$daynumber/git
mkdir ~/dotfiles/backups/$machine/$daynumber/vim
mkdir ~/dotfiles/backups/$machine/$daynumber/news

# git
cp ~/.gitconfig ~/dotfiles/backups/$machine/$daynumber/git/gitconfig_$logdate

# zsh
#cp ~/.zshrc ~/dotfiles/backups/$machine/$daynumber/zsh/zshrc_$logdate
#cp ~/.zsh_history ~/dotfiles/backups/$machine/$daynumber/zsh/zsh_history_$logdate
#cp ~/.zsh_aliases ~/dotfiles/backups/$machine/$daynumber/zsh/zsh_aliases_$logdate

# vim
cp ~/.vimrc ~/dotfiles/backups/$machine/$daynumber/vim/vimrc_$logdate

# newsbeuter
cp ~/.newsbeuter/config ~/dotfiles/backups/$machine/$daynumber/news/config
cp ~/.newsbeuter/urls ~/dotfiles/backups/$machine/$daynumber/news/urls
# backup bash

cp ~/.inputrc ~/dotfiles/backups/$machine/$daynumber/bash/inputrc_$logdate
cp ~/.bashrc ~/dotfiles/backups/$machine/$daynumber/bash/bashrc_$logdate
cp ~/.bash_aliases ~/dotfiles/backups/$machine/$daynumber/bash/bash_aliases_$logdate

Comments