Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

This script makes a backup of my home directory.

#!/bin/bash

# This script makes a backup of my home directory.

cd /home

# This creates the archive
tar cf /var/tmp/home_franky.tar franky > /dev/null 2>&1

# First remove the old bzip2 file.  Redirect errors because this generates some if the archive
# does not exist.  Then create a new compressed file.
rm /var/tmp/home_franky.tar.bz2 2> /dev/null
bzip2 /var/tmp/home_franky.tar

# Copy the file to another host - we have ssh keys for making this work without intervention.
scp /var/tmp/home_franky.tar.bz2 bordeaux:/opt/backup/franky > /dev/null 2>&1

# Create a timestamp in a logfile.
date >> /home/franky/log/home_backup.log
echo backup succeeded >> /home/franky/log/home_backup.log
Comment

PREVIOUS NEXT
Code Example
Shell :: linux while one line command 
Shell :: daily bing ubuntu 
Shell :: add user to sudoer "zsh" same customization for root 
Shell :: git close private repo 
Shell :: conda install tabulate 
Shell :: install ansible on linux 
Shell :: mv command in linux to rename 
Shell :: linux apt ignore not found package 
Shell :: debian build with ccache 
Shell :: install pillow error alpine linux 
Shell :: active command line macbook developer 
Shell :: how to install alacritty on ubuntu 
Shell :: bash continue on error 
Shell :: jq for xml 
Shell :: linux microcore static ip 
Shell :: command line if output of command is equal to string 
Shell :: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package nano 
Shell :: install extension ext-gd * in fedora 
Shell :: install adb on mac 
Shell :: prettier check 
Shell :: pngquant-bin@4.0.0 postinstall: `node lib/install.js` 
Shell :: merge two branches git 
Shell :: git delete all local branches 
Shell :: bashrc check if interactive 
Shell :: linux remove lines from file 
Shell :: git clone all repositories in organization 
Shell :: grep second match 
Shell :: create new file and copy from another file in powershell 
Shell :: kubernetes add or remove label from existing resource 
Shell :: screenshot shortcut in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =