fork download
  1. #!/bin/bash
  2. #
  3. # creates backups of essential files
  4. #
  5. DATA="/home /root /usr/local/httpd"
  6. CONFIG="/etc /var/lib /var/named"
  7. LIST="/tmp/backlist_$$.txt"
  8. #
  9. mount /mnt/backup
  10. set $(date)
  11. #
  12. if test "$1" = "Sun" ; then
  13. # weekly a full backup of all data and config. settings:
  14. #
  15. tar cfz "/mnt/backup/data/data_full_$6-$2-$3.tgz" $DATA
  16. rm -f /mnt/backup/data/data_diff*
  17. #
  18. tar cfz "/mnt/backup/config/config_full_$6-$2-$3.tgz" $CONFIG
  19. rm -f /mnt/backup/config/config_diff*
  20. else
  21. # incremental backup:
  22. #
  23. find $DATA -depth -type f \( -ctime -1 -o -mtime -1 \) -print > $LIST
  24. tar cfzT "/mnt/backup/data/data_diff_$6-$2-$3.tgz" "$LIST"
  25. rm -f "$LIST"
  26. #
  27. find $CONFIG -depth -type f \( -ctime -1 -o -mtime -1 \) -print > $LIST
  28. tar cfzT "/mnt/backup/config/config_diff_$6-$2-$3.tgz" "$LIST"
  29. rm -f "$LIST"
  30. fi
  31. #
  32. # create sql dump of databases:
  33. mysqldump -u root --password=mypass --opt mydb > "/mnt/backup/database/mydb_$6-$2-$3.sql"
  34. gzip "/mnt/backup/database/mydb_$6-$2-$3.sql"
  35. #
  36. umount /mnt/backup
  37.  
Runtime error #stdin #stdout 0.02s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty