Skip to content

Instantly share code, notes, and snippets.

@potatoru
Created October 2, 2016 22:37
Show Gist options
  • Save potatoru/12d42080b18de49afe8ca691deb24db1 to your computer and use it in GitHub Desktop.
Save potatoru/12d42080b18de49afe8ca691deb24db1 to your computer and use it in GitHub Desktop.
#!/bin/sh
shares=(
'000 - Document Database'
'001 - Administrative'
'002 - Construction'
'003 - HSE'
'004 - Material'
'005 - QC'
'006 - PDDM'
'007 - Project Control'
'008 - Management'
'009 - Additional Work Log'
'010 - QC E&I'
'999 - Common'
)
storage='/mnt/HD_a2'
date=`date +"%d-%m-%Y"`
for share in "${shares[@]}"
do
filename="[$date] $share.tar"
tar -cf "$storage/backup/$filename" "$storage/$share"
done
tar -cf "$storage/backup/[$date] etc.tar" "/etc"
find "$storage/backup/" -maxdepth 1 -mtime +2 -type f -exec rm -rv {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment