daily pastebin goal
7%
SHARE
TWEET

Back-Up-Script-Desktop

jv2112 Apr 17th, 2016 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2.  
  3. # Redundancy of Data : Data, Package List , Key Config Files.
  4.  
  5. # Logs
  6.  
  7. touch /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
  8. date >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
  9. echo "************************************************************************" >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
  10. ls /home/joe/ -lhR >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
  11. echo "************************************************************************" >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
  12. ls / -lhR >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
  13. echo "************************************************************************" >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
  14.  
  15. touch /home/joe/System-Logs/Packages/"packages--$(date +%F)"
  16. echo "Installed Packages" >> /home/joe/System-Logs/Packages/"packages--$(date +%F)"
  17. echo "************************************************************************" >> /home/joe/System-Logs/Packages/"packages--$(date +%F)"
  18. pacman -Qq >> /home/joe/System-Logs/Packages/"packages--$(date +%F)"
  19. echo "************************************************************************" >> /home/joe/System-Logs/Packages/"packages--$(date +%F)"
  20.  
  21.  
  22. # Important Configuration Files
  23.  
  24. # System
  25. cat /etc/anacrontab > /home/joe/System-Logs/Config.bak/Anacrontab/"Current_Anacrontab--$(date +%F)"
  26. cp -uv /etc/pacman.conf /home/joe/System-Logs/Config.bak/Pacman/"pacman.conf-$(date +%F)"
  27. cp -uv /etc/pacman.d/mirrorlist /home/joe/System-Logs/Config.bak/Mirror/"mirrorlist-$(date +%F)"
  28. cp -uv /home/joe/.bashrc /home/joe/System-Logs/Config.bak/Bash/"Joe-bashrc--$(date +%F)"
  29. cp -uv /home/joe/.zshrc /home/joe/System-Logs/Config.bak/ZSH/"Joe-zshrc--$(date +%F)"
  30. cp -uv /home/joe/.tmux.conf /home/joe/System-Logs/Config.bak/TMUX/"Joe-tmux.conf--$(date +%F)"
  31. cp -uv /etc/samba/smb.conf /home/joe/System-Logs/Config.bak/SMB/"smb.conf--$(date +%F)"
  32. cp -uv /home/joe/.vimrc /home/joe/System-Logs/Config.bak/VIM/"vimrc-$(date +%F)"
  33.  
  34.  
  35. # Conky Files
  36. mkdir -p /home/joe/System-Logs/Config.bak/Conky/"Conky-Archive-$(date +%F)"
  37. rsync -avz /home/joe/.conky/ /home/joe/System-Logs/Config.bak/Conky/"Conky-Archive-$(date +%F)"/
  38.  
  39.  
  40. #I3
  41. cp -uv /home/joe/.config/i3/config /home/joe/System-Logs/Config.bak/I3/"I3-Config--$(date +%F)"
  42.  
  43. #SQL
  44. #mysqldump -u joe -pjasl2112 --all-databases >> /home/joe/System-Logs/SQL/"$(date +%F)-alldb.sql"
  45.  
  46. # Back up of Etc -- System Config Files
  47. rsync -av -t  --delete /etc/ /home/joe/System-Logs/Config.bak/etc/
  48.  
  49. # Data Back Up
  50.  
  51. # Archive
  52. #Media
  53.  
  54. #Video
  55. rsync -av -t  --delete /media/Bit-Bucket/TV/ /media/Archive/TV/
  56. rsync -av -t  --delete /media/Bit-Bucket/Movies/ /media/Archive/Movies/
  57. rsync -av -t  --delete /media/Bit-Bucket/Music-Videos/ /media/Archive/Music-Videos/
  58. rsync -av -t  --delete /media/Bit-Bucket/Kids/ /media/Archive/Kids/
  59. rsync -av -t  --delete /media/Bit-Bucket/Tutorials/ /media/Archive/Tutorials/
  60.  
  61. # Pictures / Family Video
  62. rsync -av -t  --delete /media/Bit-Bucket/Memories/ /media/Archive/Memories/
  63.  
  64. # Audio
  65. rsync -av -t  --delete /media/Bit-Bucket/Audio-Books/ /media/Archive/Audio-books/
  66. rsync -av -t  --delete /media/Bit-Bucket/Tunes/ /media/Archive/Tunes/
  67.  
  68. # Home BU : Data / Configs
  69. rsync -av -t  --delete /home/joe/ /media/Archive/joe/
  70.  
  71.  
  72. find /home/joe/System-Logs/ -type f -and -mtime +31 -delete
  73.  
  74. echo "$USER the back up process has completed. $HOSTNAME is history is safe." |espeak  -s 160 -v en-uk -p 30  -a 20  2> /dev/null  
  75. xcowsay --cow-size=small --think --image=/media/Bit-Bucket/Memories/Cool-Graphics/Icon/apps/supertux.png --no-wrap --font="Nimbus Roman No9 L 10 Bold" --font="Tahoma 10 Bold" "$USER the back up process has completed. $HOSTNAME is history is safe."
  76.  
  77.  
  78. ### Restore Directions ############
  79.  
  80. #    https://wiki.archlinux.org/index.php/System_Restore_from_Configurations
  81.  
  82. # -------- Deprecated Commands -------- #
  83.  
  84. # Make copy of MBR -- set in root crontab to dump twice a week.
  85. # dd if=/dev/sda of=/home/joe/System-Logs/MBR/"mbr-$(date +%F)" count=1 bs=512
  86. # Restore MBR ----> dd if=/home/joe/System-Logs/MBR/"mbr-$(date +%F)" of=/dev/sda count=1 bs=512
  87.  
  88. # I3
  89. #cp -uv /home/joe/.config/i3/config /home/joe/System-Logs/I3/"I3-Config--$(date +%F)"
  90. #cp -uv /home/joe/Conky/conkyrc.bar /home/joe/System-Logs/I3/"Conkyrc.bar--$(date +%F)"
  91. #cp -uv /home/joe/.i3blocks.conf /home/joe/System-Logs/I3/"i3blocks.conf--$(date +%F)"
  92.  
  93. # Openbox
  94. #cp -uv /home/joe/.config/openbox/autostart /home/joe/System-Logs/Config.bak/Openbox/"autostart--$(date +%F)"
  95. #cp -uv /home/joe/.config/openbox/menu.xml /home/joe/System-Logs/Config.bak/Openbox/"menu.xml--$(date +%F)"
  96. #cp -uv /home/joe/.config/openbox/rc.xml /home/joe/System-Logs/Config.bak/Openbox/"rc.xml--$(date +%F)"
  97. #cp -uv /home/joe/.config/tint2/tint2rc /home/joe/System-Logs/Config.bak/Openbox/"tint2rc--$(date +%F)"
  98.  
  99. # LXDE
  100. #cp -uv  /etc/xdg/lxsesssion/LXDE/autostart /home/joe/System-Logs/Config.bak/Openbox/"LXDE-autostart--$(date +%F)"
  101. #cp -uv /home/joe/.config/openbox/lxde-rc.xml /home/joe/System-Logs/Config.bak/Openbox/"lxde-rc.xml--$(date +%F)"
  102. #cp -uv /home/joe/.config/openbox/rc.xml /home/joe/System-Logs/Config.bak/Openbox/"rc.xml--$(date +%F)"
  103. #touch /home/joe/System-Logs/Packages/"Current_Packages--$(date +%F)"
  104.  
  105. #dpkg --get-selections | grep -v deinstall >> /home/joe/System-Logs/Packages/"Current_Packages--$(date +%F)"
  106. #cp -uv /etc/samba/smb.conf /home/joe/System-Logs/Config.bak/Samba/"smb.conf--$(date +%F)"
  107. # Set of instructions to back up packages --> Line  6 above backs up.
  108.  
  109. # http://www.arsgeek.com/2006/09/19/ub...tall-packages/
  110.  
  111. # Package list should have been created and saved to file and stored to backup disk by using this command...
  112.  
  113.  
  114. #   dpkg --get-selections | grep -v deinstall > /media/disk/backup/installed-package-list
  115.  
  116. # The above command creates the list and saves it to my backup disk.
  117.  
  118. # To use this list to recreate the Linux system follow these steps...
  119. #       1) Reinstall base system
  120. #       2) Copy nessessary files from backup - entire network directory copied back to /etc/, sources.list copied back to etc/apt/
  121. #       3) Open network config window and enter encryption key. You now have internet access and the proper source.list to reinstall your packages.
  122. #       4) sudo apt-get update
  123. #       5) sudo apt-get dist-upgrade
  124. #       6) dpkg --set-selections < /media/disk/backup/installed-package-list
  125. #       7) sudo apt-get install dselect
  126. #       8)sudo dselect
  127. #       9) when promted, choose to install packages
  128.  
  129. # You can now use...
  130. #       dpkg --get-selections | grep -v deinstall > /new-system-installed-package-list
  131.  
  132. # ...to create a new list to compare with package-list from old system.
  133.  
  134. # When I am in dselect there is an option to configure non-configured packages. This option does nothing that I can see.
  135.  
  136.  
  137. # Old Attempts -> Notes
  138.  
  139. #bzip compression Tar ball of Home
  140. #cp -uv /etc/bash.bashrc /home/joe/Documents/Config.bak/
  141. #cp -uv /etc/samba/smb.conf /home/joe/Documents/Config.bak/
  142. #rsync -av  /home/joe/ /media/Abyss/Archive/joe-home-bu
  143. #tar cjvf /media/Abyss/Archive/"$(date +%F)_Joe".bz2 /media/Abyss/Archive/joe-home-bu/
  144.  
  145. # tar options /media/Abyss/Archive/Filename.zip  Source Directory/
  146. # c= create v=verbose f=filename j=bzip compression / t= table of contents (tar tvf filename ls file)
  147. #tar is recursive by nature n flag is needed to turn off.
  148.  
  149. #find /media/Abyss/Archive -iname *.bz2 -and -ctime -1 -exec cp {} /media/Linuxlab/Zip-Redundancy \;
  150. #find /media/ -iname *Joe.bz2 -atime +7 -delete
  151.  
  152. # espeak Options
  153.  
  154. # -a <integer>
  155. # Amplitude, 0 to 20, default is 10
  156.  
  157. # -l <integer>
  158. # Line  length. If not zero (which is the default), consider lines
  159. # less than this length as and-of-clause
  160.  
  161. #-p <integer>
  162. # Pitch adjustment, 0 to 99, default is 50
  163.  
  164. #-s <integer>
  165. # Speed in words per minute, default is 160
  166.  
  167. #-v <voice name>
  168. # Use voice file of this name from espeak-data/voices
  169.  
  170.  
  171. # Personal Backup removal 7 day +
  172. # Since work is Mannual needs to be done by hand.
  173.  
  174. # BU w/ Zip about 15% less compression Ratio
  175.  
  176. #! /bin/bash
  177. #zip -r -9 /media/Abyss/Archive/"Joe--->$(date)".zip /home/joe/
  178. # add -e option to ZIP for encryption -> zip -er (E-Encryption / R- Recursive) /media/Abyss/Archive/Filename.zip  Source Directory/
  179. #find /media/Abyss/Archive -name *.zip -amin -1435 -exec cp -a {} /media/Linuxlab/Zip-Redundancy \;
  180. #find / -name *Joe*.zip -atime +7 -exec rm {} \;
  181. # Personal Backup removal 7 day +
  182. # Since work is Mannual needs to be done by hand.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top