pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

pastebin private pastebin - collaborative debugging tool What's a private pastebin?

Posted by Frymaster on Wed 2nd Sep 18:19
download | new post

  1. #!/bin/bash
  2.  
  3. #dest is year-month-day--hourminute
  4. #ie 2008-09-01--1237
  5.  
  6. if [ $UID -ne 0 ]; then
  7.         sl
  8.         echo "This must be run as root"
  9.         exit
  10. fi
  11.  
  12. timestamp=`date +%y-%m-%d--%H%M`
  13. backup_location=/storage/backup
  14. #If you are pulling files down from a remote server, put user@host: (need the colon) here (and "user" should really be root)
  15. #You will need to either have a key-based ssh access for root, or to type the password in
  16. server=
  17. include_file=/storage/backup/include
  18. exclude_file=/storage/backup/exclude
  19. link_dest=`ls -dt $backup_location/??-??-??--????*/ | head -n 1`
  20.  
  21. #our very leet "delete backups when running out of space" script
  22. $backup_location/check-backup-space.py
  23.  
  24. echo Backup up MYSQL database
  25. nice mysqldump --all-databases -u root -h localhost -pSOMEPASSWORDOROTHER > /var/mysql-backups/sql$timestamp.sql && nice gzip -9 /var/mysql-backups/sql$timestamp.sql
  26.  
  27. echo Copying over files
  28. for i in $(  sed 's/ *#.*//' $include_file ); do
  29.  
  30.      nice rsync -maz -l --relative --link-dest=$link_dest --exclude-from="$exclude_file" $server$i $backup_location/$timestamp
  31.  
  32. done
  33. rm $backup_location/last_backup
  34. ln -s $backup_location/$timestamp $backup_location/last_backup

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Use syntax highlighting

To highlight particular lines, prefix each line with @@


Remember my settings