Friday 23 December 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

No comments:

Post a Comment