![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Web Programming, Web 2.0 and Mashups Discuss Web Programming and Web Server Administration, including LAMP, Apache, MySQL, Flash, HTML, SEO, Mashups and other Web APIs and topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MySQL Developer, meet “Quan” (aka the MySQL Query Analyzer) | iBot | MySQL DevZone RSS | 0 | 05-15-2009 01:30 PM |
| MySQL University - Training on MySQL Development & Internals | iBot | Solaris BigAdmin RSS | 0 | 11-12-2008 09:10 AM |
| how to break mysql dump sql file | learnbash | Shell Programming and Scripting | 2 | 05-14-2008 05:39 AM |
| restore mysql dump file in many remote servers? | blesets | Shell Programming and Scripting | 2 | 09-13-2006 01:17 AM |
| help, what is the difference between core dump and panic dump? | aileen | UNIX for Dummies Questions & Answers | 1 | 06-11-2001 08:08 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
Hello. the purpose of my efforts right now are to get a larger script of mine (which the admin told me he'd put into cron for me) to properly back-up my MySQL database. To test out the sql back-up part (before getting the whole script into cron, and having it not work) I wanted to test it. So here's what I did:
PHP file to do my testing (on the live server) Code:
<?php
$test = shell_exec('echo $SHELL');
echo "<pre>$test</pre>";
$output = shell_exec('sh ./sqlBack.sh');
echo "<pre>$output</pre>";
?>
Code:
#!/usr/local/bin/bash # MYSQL BACKUP: sql_bDir="./sql_backups/" #LOCATION FOR SQL BACKUPS TO LAND sql_bName=SqlBackup_$(date "+%A") echo "The Shopping Cart's database backup will be in $sql_bDir and will be named $sql_bName" #NOTICE OF DATABASE BACKUP mysqldump -uNAME -pPASS --opt DBASENAME > $sql_bDir$sql_bName.tgz Thanks in advance for all your help!! |
|
|||||
|
Thanks for the reply!!
Quote:
Quote:
This is what i found: Quote:
Quote:
Quote:
Thanks for all your help!! |
|
||||
|
Quote:
test.php Code:
<?php
$output=shell_exec('sh /home/jzacsh/public_html/private/scripts/dbackup.sh');
echo "<pre>$output</pre>";
?>
Code:
#!/bin/sh
sql_bDir=./sql_pickup/
#START SQL BACKUP + TGZ
echo " " #VISUAL PADDING
echo "# BEGINNING DATABASE BACKUP PORTION:" #VISUAL
#MYSQL LANDING DIR. CHECK
echo "Checking if sql backup landing directory exists: $sql_bDir"
if test -d "$sql_bDir"
then
echo "Directory to receive database backup exists"
else
echo "Directory to receive database backup does not exist, creating it"
mkdir $sql_bDir
fi #ENDIF SQL DIR. CHECK
echo " " #VISUAL PADDING
# MYSQL BACKUP
sql_bName=SQLBackUp_$(date +%A).gz
sql_Path=$sql_bDir$sql_bName
echo "The Shopping Cart's database backup will be:" $sql_Path #NOTICE OF DATABASE BACKUP
echo "Note: If the main backup is backing up the root directory, you do not need to separately download the database backup."
mysqldump -u name -p wppass --single-transaction db123 | dd bs=1M | gzip -c > $sql_Path
Code:
# BEGINNING DATABASE BACKUP PORTION: Checking if sql backup landing directory exists: ./sql_pickup/ Directory to receive database backup exists The Shopping Cart's database backup will be: ./sql_pickup/SQLBackUp_Tuesday.gz Note: If the main backup is backing up the root directory, you do not need to separately download the database backup. Any ideas what I could be doing wrong?? |
|
||||
|
Quote:
(the file still comes out 0 B, just uncompressed)test.php output: Code:
# BEGINNING DATABASE BACKUP PORTION: Checking if sql backup landing directory exists: ./sql_pickup/ Directory to receive database backup exists The Shopping Cart's database backup will be: ./sql_pickup/SQLBackUp_Tuesday Note: If the main backup is backing up the root directory, you do not need to separately download the database backup. Code:
#!/bin/sh sql_bName=SQLBackUp_$(date +%A) mysqldump -u jzacsh_jzacsh -p wordpres --single-transaction jzacsh_jzwp > $PWD/sql_pickup/$sql_bName echo $SHELL ...it returned /usr/local/cpanel/bin/noshell i'm guessing that means I can't run things properly? (I'm not sure, I obviously had a shell to output a file with and everything... I just wasn't successful in outputting a GOOD file) |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| backup, mysql, php test |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|