Advertisement
anang143

Untitled

Apr 20th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.45 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Database credentials
  4.  user="polisi"
  5.  password="polisi123"
  6.  host="polisi123"
  7.  db_name="polisi123"
  8. # Other options
  9.  backup_path="/mnt/backup/db"
  10.  date=$(date +"%d-%b-%Y")
  11.  
  12. # Set default file permissions
  13.  umask 177
  14.  
  15. # Dump database into SQL file
  16.  mysqldump --user=$user --password=$password --host=$host $db_name > $backup_path/$db_name-$date.sql
  17.  
  18.  
  19. # Delete files older than 30 days
  20.  find $backup_path/* -mtime +7 -exec rm {} \;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement