Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1.  
  2. 35 18 * * * root php /var/www/bckup.php
  3.  
  4.  
  5. <?php
  6. $tmpDir = "/tmp/";
  7. $user = "root";
  8. $password = "root";
  9. $dbName = "ourbank";
  10. $prefix = "ourbank_";
  11.  
  12. $subject = "db - backup";
  13. $sqlFile = $tmpDir.$prefix.date('Y_m_d').".sql";
  14. $attachment = $tmpDir.$prefix.date('Y_m_d').".tgz";
  15.  
  16. $creatBackup = "mysqldump -u ".$user." --password=".$password." ".$dbName." > ".$sqlFile;
  17.  
  18. $createZip = "tar cvzf $attachment $sqlFile";
  19. exec($creatBackup);
  20. exec($createZip);
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement