Jump to content

a simple script for backups?


Im Jake

Recommended Posts

Heres a simple way to do it.

 

mysqldump -ce --user=username --password=password dbname | gzip | uuencode dbbackup_e.gz | mail email@address.com

 

Chaneg the dbbackup_e.giz to a time(); format, use mkdir and name it the time(); format, and move the renamed file to your backup folder.

 

or like this

 

$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
system($command);

Link to comment
Share on other sites

<?
$dbhost = "localhost";
$dbuser = "runefant";
$dbpass = "pass here";
$dbname = "runefant_rf";
$backupfile = "backup";

$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
system($command);
echo "Success!!!";
?>

 

thats my total code and its not making a backup :(

Link to comment
Share on other sites

Was just working with him..

 

Here's the file:

 

<?

$dbhost = "localhost";

$dbuser = "runefant";

$dbpass = "";

$dbname = "runefant_rf";

$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';

$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";

system($command);

echo "Success!!!";

?>

 

He's getting the echo Success!!! but the file is not being made.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.