Saturday 29 October 2011

How to create a simple backup script with current date and time


Below is a Linux Shell script to create a backup directories with the current date and time stamps


#!/bin/bash

current_time=`date +%Y-%m-%d-%H:%M:%S`
echo  $current_time
backup_dir_name=backups-$current_time
backup_dir=/opt/your_backup_dir_location/$backup_dir_name
echo "Creating the backup directory $backup_dir"
mkdir $backup_dir
echo "backupdir = $backup_dir"
echo
sleep 2

1 comment:

  1. how to backup fileserver (/share and /home folder) in external portable drive which is connected all time with file server

    ReplyDelete