Web Hosting Forum | Lunarpages

Author Topic: Site and MySQL backups via cron  (Read 123550 times)

Offline skylerj

  • Trekkie
  • **
  • Posts: 15
Site and MySQL backups via cron
« Reply #15 on: January 02, 2005, 11:04:28 PM »
Thank you for getting back to me. I'm trying to run the first script that you posted. The only thing that is different from what you posted is the top portion where I put in all of my server settings. This is the error that I get.

Quote
Warning: exec() has been disabled for security reasons in /home/koopat2/public_html/sitebackup.php on line 13

Warning: exec() has been disabled for security reasons in /home/koopat2/public_html/sitebackup.php on line 16
Connected to *****.serveftp.org, for user ***** upload has failed.
Warning: unlink(/home/koopat2/Full_Account_Backup-2005-01-02_22-51-57.tar.gz): No such file or directory in /home/koopat2/public_html/sitebackup.php on line 56

I'm not an expert, but I was under the impression that enableing and disableling of the exec comman for security reasons was something that only server admin could control. Or maybe something else is going on. In any case, I would love some information and advice. Thanks!

Offline scanman20

  • Senior Moderator
  • Über Jedi
  • *****
  • Posts: 1549
    • http://www.notonebit.com
Site and MySQL backups via cron
« Reply #16 on: January 03, 2005, 07:00:31 AM »
Some servers on LP have the exec() function disabled which would make it impossible to use with the above scripts.
Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP (<- unused since 2006!)

Offline skylerj

  • Trekkie
  • **
  • Posts: 15
Site and MySQL backups via cron
« Reply #17 on: January 03, 2005, 08:01:13 AM »
That's what I figured was the cause.  If a lunarpage employee confirms that, my question becomes: What are my options in order to have automated backup to an offsite server? I think an auto-backup service, or to have the ability to set up such a service with a script and/or cron command, is a reasonable expectation to have of a webhost.

Danielle

  • Guest
Site and MySQL backups via cron
« Reply #18 on: January 03, 2005, 08:13:09 AM »
Actually, you could simply request to be moved to an exec() enabled server since you require this functionality.  You'd just email support@lunarpages.com and provide your Cpanel username and the last 4 digits of your credit card on file with us (no charges apply) and note that you need to be transferred to an exec() capable server.

Offline BlueTicona

  • Spaceship Navigator
  • *****
  • Posts: 77
    • http://www.bluetopmedia.net
Site and MySQL backups via cron
« Reply #19 on: January 03, 2005, 04:13:44 PM »
Quote from: Danielle
Blueticona, you're welcome, although I just posted it in the how-to section; the main kudos should go to scanman who created the scripts  :yey:


walks around with his bag of kudos to give to various people[/i]

 :poke:   :thumb:
http://www.DreamTune.comThe Melody of Magic & New Age!

We are a support community for pagans and their Magical & New Age lifestyles. This community is meant to be a gathering place for everyone to get together and exchange information on various Paths, Teachings & Healings.

Offline triscuit

  • Trekkie
  • **
  • Posts: 12
Site and MySQL backups via cron
« Reply #20 on: January 10, 2005, 08:51:07 PM »
I was wondering how I just compress the database into a zip file daily and let it sit on the server in the dir of my choosing.  Then a client on my computer will connect and download the zipped file daily.  I had this setup before but lunarpages erased my crontab because I had a process that was using too much cpu time.  This one got erased along with the resource hog and I would like to restore it.

Offline scanman20

  • Senior Moderator
  • Über Jedi
  • *****
  • Posts: 1549
    • http://www.notonebit.com
Site and MySQL backups via cron
« Reply #21 on: January 11, 2005, 06:04:22 AM »
Quote from: triscuit
I was wondering how I just compress the database into a zip file daily and let it sit on the server in the dir of my choosing.  Then a client on my computer will connect and download the zipped file daily.  I had this setup before but lunarpages erased my crontab because I had a process that was using too much cpu time.  This one got erased along with the resource hog and I would like to restore it.
Just use the MySQL backup via cron - Emailed to You script I wrote and comment out or delete the email section. It will leave the backup file in the folder where it was created, and overwrite it everytime the cron runs.
Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP (<- unused since 2006!)

Offline _silex

  • Intergalactic Superstar
  • *****
  • Posts: 152
    • http://blogcult.com
Site and MySQL backups via cron
« Reply #22 on: January 12, 2005, 09:48:27 PM »
Scanman, great work and I needed a script like this to email me my backups.  I did have one that would archive them locally (Thanks to Lupus!), but this script is a definate must have.  Although I did run into a problem using the email script.  Trying to gzip all databases using --all-databases or -A doesn't work on Lunarpages?

Not sure why, but --all-databases won't work for me, although commenting out this line:
Code: [Select]
$dbname = "";   // Database name. Use --all-databases if you have more than one
And using this in $command works fine:
Code: [Select]
$command = "mysqldump -u $dbuser --password=$dbpwd --databases database1 database2 database3 | gzip > $filename";
Any reason why --all-databases won't work?
Blogcult : Free Blog & Journal Hosting

Offline Chopsy666

  • Newbie
  • *
  • Posts: 4
Site and MySQL backups via cron
« Reply #23 on: January 18, 2005, 12:30:52 AM »
Hi,

If i wanted to have the backup emailed to 2 addresses do i just add the
mail($to, $subject, $content, $headers);  line twice and change the variables as appropriate

Thanks
          Nav

Offline scanman20

  • Senior Moderator
  • Über Jedi
  • *****
  • Posts: 1549
    • http://www.notonebit.com
Site and MySQL backups via cron
« Reply #24 on: January 18, 2005, 06:09:54 AM »
No, you would change the $to variable to a comma delimited list of addresses.  :thumb:
Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP (<- unused since 2006!)


Offline Chopsy666

  • Newbie
  • *
  • Posts: 4
Site and MySQL backups via cron
« Reply #26 on: January 24, 2005, 02:44:10 AM »
Thanks for that scanman20,  i can't actually get the script working at all at the moment and it doesnt give men any error messages, but i will look into that before asking you for help :o

One other slightly related question, the file that is downloaded is a .gz file. winzip just extracts it to a single file. I have just started learning PHP & mysql so that i can support my own site fully rather than ask programmers. I would like to load my database onto my mysql prgram on my laptop, but i am not sure how as i was expecting lots of files such as .fyi (forgive me if that extention is wrong) that i could copy into the relative folder on my machine.  Any ideas?

Thanks
    Nav

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5177
    • Joke A Whenever
Site and MySQL backups via cron
« Reply #27 on: January 24, 2005, 06:03:53 AM »
The backup/dump file is actually just a large mySQL query that will recreate the data for you in your DB.

- Ed

Does anyone have any ideas on how to get this script to work if PHP safe mode is on and no access to passthru etc?

Offline Chopsy666

  • Newbie
  • *
  • Posts: 4
Site and MySQL backups via cron
« Reply #28 on: January 25, 2005, 01:59:40 PM »
Hi,

I had lots of errors which were avoided by replacing // with /* & \\ with *\. However now the file that is emailed is called unnamed (outlook express quarantined it as unnamed.dat). When i upload it to my test server and go into phpadmin it says there are no tables so im not sure what i've made the script do, any ideas would be much appreciated.

Thanks
     Nav

Offline mnemonik23

  • Trekkie
  • **
  • Posts: 11
Site and MySQL backups via cron
« Reply #29 on: February 04, 2005, 09:38:40 PM »
Hello,

I have a problem with site backup script:
I'm connected to the ftp - I see "Connected to my_server, for user my_user"

BUT $upload is not working: "FTP upload has failed."
And of course
Warning: unlink(/home/my_user/Full_Account_Backup-2005-02-04.tar.gz): No such file or directory in /home/my_user/public_html/backup/backup_site.php on line 56

Any suggestions would be greatly appreciated!

 

Share |