Ubuntu Pastebin

Paste from ioria2 at Sat, 9 Apr 2016 19:33:59 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
echo "				TAR BACK-UP                     "
echo "where you want your .tar created  (path) ?  "
read lin
echo "Insert target  folder to back-up  (path) :  "
read line
cd $line

file="dir.md5"

if [[ ! -f $file ]]; then
  touch $file
fi


md5_1=$(md5sum 'dir.md5' | cut -d ' ' -f 1)

ls -t > dir.md5 && du -b * | awk '{ print $1, "* 8" }' | bc  >> dir.md5
md5_2=$(md5sum 'dir.md5' | cut -d ' ' -f 1)

if [ $md5_1 != $md5_2 ]
then
    #echo "The directory was modified since the last run"
    tar -zcvf $lin/archive_`date +%Y%m%d_%H%M%S`.tar.gz  *
fi
Download as text