TotalChoice Hosting Family Forums: Cronjob Of Cpanel Backup - TotalChoice Hosting Family Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Cronjob Of Cpanel Backup

#1 User is offline   Farnes 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 21
  • Joined: 28-July 03

Posted 16 February 2004 - 04:41 PM

I've scoured the forums but can't seem to find an answer...

How can I set up a cronjob to run (say every morning at 3:30am) to perform the cPanel home directory backup and ftp it somewhere?

Thanks much for the help!

#2 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 16 February 2004 - 11:32 PM

cPanel itself doesn't have an option to cron individual cPanel accounts.

I put this together based on some info I found on cpanel.net and looking at cPanel itself. It works by posting a request to cPanel to run the backup (so it can maintain the same method of backup as cpanel is upgraded). You could actually run this on any machine that has web access to your TCH host and PHP installed, you wouldn't necessarily need to run it on your account.

Disclaimers:
    I wouldn't recommend using this script unless you at least minimally understand what it does.
    This does contain passwords, so I recommend setting the permissions on this file to 600 and not placing this file within your public_html subdirectories. Use this script at your own risk!
To run it as a cron job (at 3:30am like you wanted), put something in your crontab like the following (if the script is in your top directory):
30 3 * * * /usr/local/bin/php /home/youraccount/fullbackup.php


Here's the actual script (name it something like fullbackup.php and make sure to set all of the configuration variables). Make sure when you cut and paste it that the $data line remains one line (the if statement is the beginning of the next line).
<deleted>  See updated version in new post below.

Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#3 User is offline   Farnes 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 21
  • Joined: 28-July 03

Posted 17 February 2004 - 01:45 AM

Works like a charm.

Thanks much!

Rock Sign

#4 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 17 February 2004 - 03:38 PM

I've updated the script to include SSL support. Although not so important if you run the script on the server you are generating the backup (besides, I don't believe the PHP on the TCH servers has SSL support compiled in)... the SSL support would be quite important if you decide to run this script somewhere else to connect to your TCH account.

<?php

// PHP script to allow periodic cPanel backups automatically.
// Based on script posted by max.hedroom in cpanel.net forums
//   This script contains passwords.  KEEP ACCESS TO THIS FILE SECURE!

// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********

// Info required for cPanel access
$cpuser = "username"; // Username used to login to CPanel
$cppass = "password"; // Password used to login to CPanel
$domain = "example.com"; // Domain name where CPanel is run
$skin = "monsoon"; // Set to cPanel skin you use (script won't work if it doesn't match)

// Info required for FTP host
$ftpuser = "ftpusername"; // Username for FTP account
$ftppass = "ftppassword"; // Password for FTP account
$ftphost = "ftp.example.com"; // Full hostname or IP address for FTP host
$ftpmode = "ftp"; // FTP mode ("ftp" for active, "passiveftp" for passive)

// Notification information
$notifyemail = "you@example.com"; // Email address to send results

// Secure or non-secure mode
$secure = 0; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP

// Set to 1 to have web page result appear in your cron log
$debug = 0;

// *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********

if ($secure) {
    $url = "ssl://".$domain;
    $port = 2083;
} else {
    $url = $domain;
    $port = 2082;
}

$socket = fsockopen($url,$port);
if (!$socket) { echo "Failed to open socket connection... Bailing out!\n"; exit; }

// Encode authentication string
$authstr = $cpuser.":".$cppass;
$pass = base64_encode($authstr);

$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$
ftpuser&pass=$ftppass&submit=Generate Backup";

// Make POST to cPanel
fputs($socket,"POST /frontend/".$skin."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
fputs($socket,"Host: $domain\r\n");
fputs($socket,"Authorization: Basic $pass\r\n");
fputs($socket,"Connection: Close\r\n");
fputs($socket,"\r\n");

// Grab response even if we don't do anything with it.
while (!feof($socket)) {
   $response = fgets($socket,4096);
   if ($debug) echo $response;
}

fclose($socket);

?>

Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#5 User is offline   Farnes 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 21
  • Joined: 28-July 03

Posted 17 February 2004 - 03:43 PM

Your help is greatly appreciated.

Thanks again!

:D

#6 User is offline   KevinW 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,024
  • Joined: 04-December 02

Posted 26 February 2004 - 11:50 PM

Instructions are now posted on the TCH Help web site here!
-kw

#7 User is offline   Farnes 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 21
  • Joined: 28-July 03

Posted 26 February 2004 - 11:53 PM

I'm sure that will help other TCH customers in the future. Thanks!

#8 User is offline   !!blue 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 351
  • Joined: 27-June 03

  Posted 22 March 2004 - 10:42 AM


Get this error when I tried to download the PHP script from the instructions page today:

Quote

Warning: fsockopen(): unable to connect to example.com:2082 in /home/total/public_html/help/HTMLobj-728/fullbackup.php on line 40
Failed to open socket connection... Bailing out!


Yikes! :o

as a side question: I'm guessing this won't do a backup of my MT SQL database right? Do I need another script for that?

later,
!!blue

<span style='font-family:Verdana'><span style='font-size:8pt;line-height:100%'><span style='color:#333333'><div style="line-height: 1.3; "><strong>personal</strong>: <a href="http://blog.zoblue.com/">blog</a> &middot; <a href="http://gallery.zoblue.com">gallery</a>


</div></span></span></span>

#9 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 22 March 2004 - 11:41 AM

You can just cut and paste the script from above until Kevin gets a chance to fix the help site.

All the script does is tell cPanel to run a full backup. That full backup does include databases, but not in a way that would be easy to restore individual databases if you needed to.

It shouldn't be hard to create a script for the individual databases part. So if people want it I could whip something up for that, too.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#10 User is offline   !!blue 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 351
  • Joined: 27-June 03

Posted 22 March 2004 - 11:57 AM

TCH-MikeJ, on Mar 22 2004, 11:41 AM, said:

It shouldn't be hard to create a script for the individual databases part.  So if people want it I could whip something up for that, too.


Yes please!

A friend of mine was going to write me a perl script but he needed my table structure for the mt DB and it would take that & dump the db into a csv, then tar&gz it. Then I would ftp in & download it.

I said to wait & see if the backup you wrote would do it; but like you said, it wouldn't be easy to restore. Hmm... how would the one you would potentially write work? Would it just tar the whole db or would it read the .... :blink: wait, I'm getting myself more confused!!

help!
!!blue

<span style='font-family:Verdana'><span style='font-size:8pt;line-height:100%'><span style='color:#333333'><div style="line-height: 1.3; "><strong>personal</strong>: <a href="http://blog.zoblue.com/">blog</a> &middot; <a href="http://gallery.zoblue.com">gallery</a>


</div></span></span></span>

#11 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 22 March 2004 - 12:24 PM

I'll take a look at it when I get some free time (tonight or tomorrow hopefully).

I could either use cPanel's db backups which do a mysql dump, gzip's it, and sends it to you. Or just do a mysql dump directly and bypass cPanel completely.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#12 User is offline   robnelli 

  • Group: Members
  • Posts: 4
  • Joined: 13-April 04

Posted 13 April 2004 - 05:40 PM

I'm trying to use your PHP script to FTP a backup file to my PC running an FTP server. I've tried both FileZilla and Windows FTP Server on my PC but I can't seem to get your script to communicate with the FTP server. I've heard that it can be done, but I can't find the post that I first read about it. Do you know how to set the FTP settings in the PHP to communicate with the FTP server? :huh:

Also, I was getting good responses from your script, but now I'm getting an error.

Good responses:

Net::FTP>>> Net::FTP(2.74)
Net::FTP>>> Exporter(5.567)
Net::FTP>>> Net::Cmd(2.25)
Net::FTP>>> IO::Socket::INET(1.26)
Net::FTP>>> IO::Socket(1.27)
Net::FTP>>> IO::Handle(1.21)
Net::FTP=GLOB(0x82884ec)<<< 220-=(<*>)=-.:. (( Welcome to PureFTPd 1.0.12 )) .:.-=(<*>)=-
Net::FTP=GLOB(0x82884ec)<<< 220-You are user number 4 of 50 allowed.
Net::FTP=GLOB(0x82884ec)<<< 220-Local time is now 17:21 and the load is 1.17. Server port: 21.
Net::FTP=GLOB(0x82884ec)<<< 220 You will be disconnected after 15 minutes of inactivity.
Net::FTP=GLOB(0x82884ec)>>> user jrnhost
Net::FTP=GLOB(0x82884ec)<<< 331 User jrnhost OK. Password required
Net::FTP=GLOB(0x82884ec)>>> PASS ....
Net::FTP=GLOB(0x82884ec)<<< 230-User jrnhost has group access to: jrnhost
Net::FTP=GLOB(0x82884ec)<<< 230 OK. Current restricted directory is /
Net::FTP=GLOB(0x82884ec)>>> TYPE I
Net::FTP=GLOB(0x82884ec)<<< 200 TYPE is now 8-bit binary
Net::FTP=GLOB(0x82884ec)>>> ALLO 1302233
Net::FTP=GLOB(0x82884ec)<<< 200 Zzz...
Net::FTP=GLOB(0x82884ec)>>> PASV
Net::FTP=GLOB(0x82884ec)<<< 227 Entering Passive Mode (127,0,0,1,52,7)
Net::FTP=GLOB(0x82884ec)>>> STOR backup-4.13.2004_16-21-24_jrnhost.tar.gz
Net::FTP=GLOB(0x82884ec)<<< 150 Accepted data connection
Net::FTP=GLOB(0x82884ec)<<< 226-31809.2 Mbytes free disk space
Net::FTP=GLOB(0x82884ec)<<< 226-File successfully transferred
Net::FTP=GLOB(0x82884ec)<<< 226 0.037 seconds (measured here), 33.13 Mbytes per second
Net::FTP=GLOB(0x82884ec)>>> QUIT
Net::FTP=GLOB(0x82884ec)<<< 221-Goodbye. You uploaded 1272 and downloaded 0 kbytes.
Net::FTP=GLOB(0x82884ec)<<< 221 Logout - CPU time spent: 0.020 seconds.
--------------------------------------------------------
Copying Reseller Config...Done
Copying Mail files....Done
Copying proftpd file....Done
Copying www logs.............
.........
Done
Grabbing mysql dbs...Done
Grabbing mysql privs...Done
Copying mailman lists....Done
Copying mailman archives....Done
Copying homedir....Done
Copying cpuser file.......Done
Copying crontab file.......Done
Copying quota info.......Done
Storing Subdomains....
Done
Storing Parked Domains....
Done
Storing Addon Domains....
Done
Copying password.......Done
Copying shell.......Done
pkgacctfile is: /tmp/backup-4.13.2004_16-21-24_jrnhost.tar.gz
Creating Archive ....Done
md5sum is: 8eec6d0519a45641c33888c25ee6768e

Bad Responses:

Can't call method "login" on an undefined value at /usr/local/cpanel/bin/ftpput line 24.
--------------------------------------------------------
Copying Reseller Config...Done
Copying Mail files....Done
Copying proftpd file....Done
Copying www logs.............
.........
Done
Grabbing mysql dbs...Done
Grabbing mysql privs...Done
Copying mailman lists....Done
Copying mailman archives....Done
Copying homedir....Done
Copying cpuser file.......Done
Copying crontab file.......Done
Copying quota info.......Done
Storing Subdomains....
Done
Storing Parked Domains....
Done
Storing Addon Domains....
Done
Copying password.......Done
Copying shell.......Done
pkgacctfile is: /tmp/backup-4.13.2004_17-11-22_jrnhost.tar.gz
Creating Archive ....Done
md5sum is: ebdc5c580beb928fe2491374f3c43aa9

#13 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 13 April 2004 - 10:47 PM

My script (and PHP) doesn't actually do any FTP. All it does is tell cPanel to run the backup and do the FTP, so it's the cPanel process that is FTPing to you. All my script does is pass parameters to cPanel.

I'd recommend doing a backup manually (without the script) and try troubleshooting the problem that way. Once you have it confirmed working again, then reenable the script. If it works fine without the script, double check all of the values you have set.

Let me know if you find anything.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#14 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 13 April 2004 - 10:52 PM

!!blue, on Mar 22 2004, 11:57 AM, said:

TCH-MikeJ, on Mar 22 2004, 11:41 AM, said:

It shouldn't be hard to create a script for the individual databases part.  So if people want it I could whip something up for that, too.


Yes please!

Btw, I haven't forgotten about this. I had the flu all last week so I didn't get to doing much of anything I wanted to during that time. :blink:

Once I finish my last minute tax stuff I'll get to it. <_<
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#15 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 13 April 2004 - 11:34 PM

robnelli, on Apr 13 2004, 05:40 PM, said:

I've tried both FileZilla and Windows FTP Server on my PC but I can't seem to get your script to communicate with the FTP server. I've heard that it can be done, but I can't find the post that I first read about it.

Ok.... after reading your post on webhostingtalk, I think I know more about what you are asking.

Have you successfully done any backup that FTP'd to your home machine? It sounded like you were still working that out. The address for your FTP is going to be your router's IP address, and you will have to allow FTP through your router to your PC (how depends on your router, look for port forwarding in the configuration). Since you are on a cable modem, it's going to be more difficult to use an automated script because your FTP address can change.

Is that where you are getting hung up, though?
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#16 User is offline   robnelli 

  • Group: Members
  • Posts: 4
  • Joined: 13-April 04

Posted 15 April 2004 - 07:49 AM

Correct. I basically can't get the FTP portion of the process to work. My PC is connected to the internet via a cable modem behind a DLink Cable/DSL Residential Gateway (DI-704). The DI-704 Gateway says that the IP address is 68.x.xxx.33. I set up FileZilla FTP Server to listen on port 21 using passive ftp IP address set to 68.x.xxx.33. I then attempt to FTP from my web account (RedHat Linux) to 68.x.xxx.33 but the connectiction times out. I understand that the IP address will change in the future (a future issue to deal with). I'll look to see if there is a port forwarding option in the router as you suggest (there are so many firewall options in the router that it may take a lot of trial and error).

#17 User is offline   robnelli 

  • Group: Members
  • Posts: 4
  • Joined: 13-April 04

Posted 15 April 2004 - 07:07 PM

Connection Success ... FTP Failure!! I finally found the proper settings for the D-Link 704 to connect to the FileZilla FTP server but the copy commands appear to be unrecognized by the FTP server. Any ideas?

From your PHP email:

Net::FTP=GLOB(0x82883bc)<<< 220-FileZilla Server version 0.8.9 beta
Net::FTP=GLOB(0x82883bc)<<< 220 Nelli FileZilla Server
Net::FTP=GLOB(0x82883bc)>>> user ....
Net::FTP=GLOB(0x82883bc)<<< 331 Password required for jrnbackup
Net::FTP=GLOB(0x82883bc)>>> PASS ....
Net::FTP=GLOB(0x82883bc)<<< 230 Logged on
Net::FTP=GLOB(0x82883bc)>>> TYPE I
Net::FTP=GLOB(0x82883bc)<<< 200 Type set to I
Net::FTP=GLOB(0x82883bc)>>> ALLO 40607502
Net::FTP=GLOB(0x82883bc)<<< 500 Syntax error, command unrecognized.
Net::FTP=GLOB(0x82883bc)>>> PASV
Net::FTP=GLOB(0x82883bc)<<< 500 Syntax error, command unrecognized.
Net::FTP=GLOB(0x82883bc)>>> QUIT
Net::FTP=GLOB(0x82883bc)<<< 221 Goodbye

From FileZilla FTP Server:

(000002) 4/15/04 19:51:47 PM - (not logged in) (63.247.69.242)> Connected, sending welcome message...
(000002) 4/15/04 19:51:47 PM - (not logged in) (63.247.69.242)> 220-FileZilla Server version 0.8.9 beta
(000002) 4/15/04 19:51:47 PM - (not logged in) (63.247.69.242)> 220 Nelli FileZilla Server
(000002) 4/15/04 19:51:47 PM - (not logged in) (63.247.69.242)> user ******
(000002) 4/15/04 19:51:47 PM - (not logged in) (63.247.69.242)> 331 Password required for jrnbackup
(000002) 4/15/04 19:51:47 PM - (not logged in) (63.247.69.242)> PASS ******
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> 230 Logged on
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> TYPE I
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> 200 Type set to I
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> ALLO 40607502
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> 500 Syntax error, command unrecognized.
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> P@SW
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> 500 Syntax error, command unrecognized.
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> QUIT
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> 221 Goodbye
(000002) 4/15/04 19:51:47 PM - jrnbackup (63.247.69.242)> disconnected.

#18 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 16 April 2004 - 10:26 AM

It looks like you probably have $ftpmode set to passiveftp. Try changing that to ftp to enable Active FTP mode.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#19 User is offline   robnelli 

  • Group: Members
  • Posts: 4
  • Joined: 13-April 04

Posted 16 April 2004 - 05:47 PM

When I do a regular ftp from the linux box, all commands are unrecognized unless I issue "passive" to turn passive mode OFF. All commands work after that. When executing your PHP, under either "passiveftp" or "ftp", I get unrecognized commands. It behaves as if passive mode is on in either case. Any ideas how to get the ftp in the php exec (or cpanel?) to set passive off?

#20 User is offline   lottos 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 18-April 04

Posted 18 April 2004 - 09:59 PM

I'd love to see a cpanel (mysql) backup script version with the same functionality (ftp to remote server) - with date on the file name!

For the theme variable, what is the correct data for the X theme (X, xtheme....) ?

#21 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 19 April 2004 - 08:49 AM

The theme variable should be the same as what shows up in your cPanel info as the theme selected. For the X theme, it should be simply "x".

To double check, look in the URL. The path should show something like: /frontend/x/index.html ... the directory after frontend is what your theme variable needs to be set to.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#22 User is offline   lottos 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 18-April 04

Posted 20 April 2004 - 06:42 PM

Thanks....


I'm looking for a script like that you've previously mentioned that will allow a cpanel like zipped mysql DB backup.

I've tried phpmyadmin for backing up plus lots of gzip and bzip2 scripts and whenever I test a recovery from these, the unzip process tells me the file is corrupt - but NOT when it's a cpanel backup, hence my interest... so at the moment I do a croned uncompressed ftp backup.

I'm not sure how cpanel do theirs, but it appears to be a different method to every other script I've used.



I've also been tested a more raw version of the script you have above, with the full backup line commented out and what I had hoped would do the mysql DB backup added, shown below, but it's a no go:



<?php
$target_host = 'currenthost';
$cpanel_userid = 'userid';
$cpanel_pass = 'thepassword';
$cpanel_theme = 'Xskin';
$ftp_host = 'ftp://myftpsite.com/httpdocs/backup/';
$ftp_user = 'mysite';
$ftp_pass = 'theftpsitepwd';
$email = 'admin@mysite.com';

//
// DO NOT ALTER ANYTHING BELOW THIS LINE
//
$user_pass = "$cpanel_userid:$cpanel_pass";
$authentication = base64_encode($user_pass);
$socket = fsockopen($target_host,2082);
if (!$socket) {
echo "$errstr ($errno)<br />\n";
} else {
// fputs($socket,"POST /frontend/$cpanel_theme/backup/dofullbackup.html?dest=ftp&email=$email& server=$ftp_host&user=$ftp_user&pass=$ftp_pass&submit=Generate Backup\r\n");
fputs($socket,"POST /getsqlbackup/DBname.gz?dest=ftp&email=$email&server=$ftp_host&user=$ ftp_user&pass=$ftp_pass\r\n");
fputs($socket,"HTTP/1.0\r\n");
fputs($socket,"Host: $target_host\r\n");
fputs($socket,"Authorization: Basic $authentication \r\n");
fputs($socket,"Connection: close\r\n\r\n");

while (!feof($socket)) {
$request = fgets($socket, 4096);
}
echo 'Done.';
fclose($socket);
}
?>

#23 User is offline   lottos 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 18-April 04

Posted 29 April 2004 - 08:11 PM

just wondering if the DB backup ftp script is still in progress?!

:)

#24 User is offline   darksied 

  • Group: Members
  • Posts: 1
  • Joined: 12-May 04

Posted 12 May 2004 - 09:23 AM

i tried the script above and all i seem to get is a blank screen after executing the php script via the browser by loading the page. i am using the default skin x and all my passwords and login information is correct does anyone have any ideas on what may be wrong or what i am doing wrong.
thanks in advance :D

#25 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 12 May 2004 - 10:37 AM

The script is meant to be run under a cron, so it doesn't have any output unless you turn debug on, or it produces an error.

You should have received an email, however, at your $notifyemail address if you defined it, from the cpanel backup process.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#26 User is offline   lottos 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 18-April 04

Posted 21 May 2004 - 02:20 AM

just in case anyone is interested in doing an automated backup to their pc, this site has a nifty little batch file for windows users:

http://www.absoblogg...hive/003217.php

it can be set to do all cpanel backups or just databases.

could be set up via your Windows scheduled jobs for ease of use when not around.

the author is very helpful with any queries!

#27 User is offline   helsby 

  • Group: Members
  • Posts: 1
  • Joined: 28-May 04

Posted 28 May 2004 - 02:29 PM

thanks for the kind words lotto. Feel free to post comments on my website as posted by lotto.

Andy

#28 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 28 June 2004 - 10:35 PM

!!blue, on Mar 22 2004, 10:42 AM, said:

as a side question: I'm guessing this won't do a backup of my MT SQL database right? Do I need another script for that?

FYI, cPanel now does mysql dumps of your databases instead of hotbackups of the mysql directories when you do full backups.

So if you do a full backup of your homedir, you will get restorable mysql databases now with it.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#29 User is offline   Snack 

  • Group: Members
  • Posts: 1
  • Joined: 03-July 04

Posted 03 July 2004 - 08:43 PM

works fine !

1 question : :unsure:

If i set cron job in standard mode, and choos option every 6 hours
wil cron be executed at 0:00, 6:00, 12:00 and 18:00 :(
or will cron be executed 6 hours from the moment you set the cron job? :huh:
and then 6 hours after that and 6 hours after that ? :blink:


well if you don't answer i'l know pretty soon any way it's 3:42 and i'm going to bed :)
will see in the morning if cron has done his job @ 6:00 or at 9:42 :)

see you all later, will be back to post findings :)

#30 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 04 July 2004 - 01:09 AM

It'll run every 6 hours calculated from 0 (midnite).

So if you set it to run every 6 hours, it will run at 0600, noon, 1800, and midnite.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#31 User is offline   dlevens 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 152
  • Joined: 11-May 04

Posted 12 July 2004 - 05:35 PM

Mike or anyone,

Is there a way to modify this script to tell cpanel to just backup a particular directory instead of a full backup? I have directory that I would like to backup often (like daily or every few days) and do not want to do a full backup as my site is large. I only need a full backup once a month or longer.

Would be nice to just backup and zip one directory.

Dennis

#32 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 12 July 2004 - 05:40 PM

All this script does is basically automate the process of using the cPanel web interface to initiate a backup, so it is therefore limited to what you can do via cPanel.

To do individual directories would require a something completey different.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#33 User is offline   mephitic 

  • Group: Members
  • Posts: 1
  • Joined: 05-August 04

Posted 05 August 2004 - 01:02 AM

I'm using this script, which is awesome BTW, and I'm having some troubles displaying the resulting pages images. They show up as red x's and it appears that the port (2082) isn't being used. Is there a way to change this?

Thanks,
MePH

#34 User is offline   arvind 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 482
  • Joined: 21-August 03

Posted 05 August 2004 - 04:28 AM

TCH-MikeJ, on Apr 14 2004, 07:52 AM, said:

!!blue, on Mar 22 2004, 11:57 AM, said:

TCH-MikeJ, on Mar 22 2004, 11:41 AM, said:

It shouldn't be hard to create a script for the individual databases part.  So if people want it I could whip something up for that, too.


Yes please!

Btw, I haven't forgotten about this. I had the flu all last week so I didn't get to doing much of anything I wanted to during that time. :blink:

Once I finish my last minute tax stuff I'll get to it. <_<

You don't need a script to do this. Just setup individual crons for each database and put this as the task

Quote

mysqldump -u cpanelusernamename_dbusername -ppassworrd cpanelname_dbname | gzip -c > /home/cpanelname/backups/backup-dbname.sql.gz


cpanelusernamename = your login username for cpanel
password = your password for the dabase (note, there is NO space between -p and password)
dbname = the name of your database

Basically this just backups up your db and zips it down !

I recommend you don't put this backup in your public_html folder

#35 User is offline   lubox.com 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 90
  • Joined: 02-June 04

Posted 23 September 2004 - 10:30 AM

Is it possible to backup only the DB and save them on a remote location??

The full backup is great, but I need to run it only once a month, while I need to DB to be backuped every 12h :)

Thxs in advance
Ludo

#36 User is offline   TCH-Rob 

  • Help Desk Manager
  • PipPipPipPip
  • Group: Members
  • Posts: 7,818
  • Joined: 11-March 03

Posted 23 September 2004 - 07:04 PM

There is an option called Download a MySQL Database Backup in the backup area

#37 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 24 September 2004 - 10:10 AM

lubox.com, on Sep 23 2004, 10:30 AM, said:

Is it possible to backup only the DB and save them on a remote location??

Easiest way is to wget the backup from the remote location (obviously, you need to have wget).

If the database was called "weblog" for example, you would do something like this:
wget --http-user=cpaneluser --http-passwd=cpanelpassword https://example.com:2083/getsqlbackup/weblog.gz


So if you have scheduling ability at the remote location, just set that up to run every 12 hours. See the wget man page if you need to do different file names to handle multiple copies, or other additional tasks.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#38 User is offline   Billy 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 30
  • Joined: 16-November 03

Posted 13 October 2004 - 04:50 PM

I have fullbackup.php set up as a daily cron job on a couple of my TCH-hosted sites, just in case I do something stupid - which happens on a fairly regular basis :lol:
It has been working great for, say, the past 6 months or so, creating a full backup everyday for both sites, and sending me a little email to let me know.

Today, after I screwed a file up on one of my sites, I went to download one of these archives to extract a backup copy of that file - only to find that there hasn't been one made for the past three days. Even though the script has been sending me emails for the past 3 days, they contained an error message that I did not detect until today. Here's a copy of the email from today:
backup_error.html

This archive, backup-10.13.2004....tar.gz, did not make it to my home directory - and it seems this has been happening since 10-11-2004.
After submitting a ticket with help desk, I was told that they don't help with development issues.
Help?

#39 User is offline   LisaJill 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,661
  • Joined: 09-March 04

Posted 13 October 2004 - 04:59 PM

Cron only sends an email on failure - so just for future reference, if you get one, that's a bad thing™.

As far as your error - it looks like it doesn't have write permissions to the folder you're trying to save to. You might check the permissions and see that they're 666 (I think that should do it. )

Hope that helps!

#40 User is offline   Billy 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 30
  • Joined: 16-November 03

Posted 13 October 2004 - 05:16 PM

Lisa -
Thanks for your help.
The cPanel script is saving to my home directory, which I don't have the ability to modify permissions on!
Any other ideas?
Thanks again

#41 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 13 October 2004 - 05:54 PM

The error is coming from the host you are ftping the file to. It appears it doesn't have permission to write the backup file to the remote host anymore. Check the permissions on your backup machine.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#42 User is offline   Billy 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 30
  • Joined: 16-November 03

Posted 13 October 2004 - 06:10 PM

Dear Mike:
Thanks for your help, too.
The host I am ftp-ing the file to is my own host, the same host that is being backed up. As I stated before, I don't have the ability to modify permissions on my own home directory. Does this mean I need to have the file put into a directory lower down on the tree?
And thanks for writing this cool script, anyways!
Billy

#43 User is offline   Raptus 

  • Group: Members
  • Posts: 1
  • Joined: 01-February 05

Posted 01 February 2005 - 01:00 PM

Thanx a lot for this script, it was exactly what I was looking for! :thumbup1:

I added some code to optimize all tables from all my DBs before the backup is executed. Then I defined the post-variable that specifies the folder of the remote ftp host in which the backup should be put, which was missing.

#44 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 01 February 2005 - 01:16 PM

Welcome to the forums, Raptus.

Glad you are finding useful information here. :)
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#45 User is offline   rowanp 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 52
  • Joined: 30-November 04

Posted 15 February 2005 - 08:35 AM

Great script, but I am having the same problem that Billy did, and the answer never seems to have been provided.

The ftp home directory permissions do not allow the backup file to be created there. As I do not wish to change the permissions on the home directory, how can the script be modified so as to upload the backup to a specific directory like /backup for instance?

Thank you.

#46 User is offline   canuck 

  • Group: Members
  • Posts: 4
  • Joined: 19-February 05

Posted 19 February 2005 - 09:29 AM

Any idea why my backup is not working ?

Net::FTP=GLOB(0x831400c)>>> STOR backup-2.19.2005_09-26-01_domains.tar.gz
Net::FTP=GLOB(0x831400c)<<< 553 Can't open that file: Permission denied Net::FTP=GLOB(0x831400c)>>> QUIT Net::FTP=GLOB(0x831400c)<<< 221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
Net::FTP=GLOB(0x831400c)<<< 221 Logout.

#47 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 19 February 2005 - 10:15 AM

Welcome to the forums canuck.

The error message denotes a permission error.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#48 User is offline   canuck 

  • Group: Members
  • Posts: 4
  • Joined: 19-February 05

Posted 19 February 2005 - 10:27 AM

Ya I know, I need to figure out wjat to change.

#49 User is offline   rowanp 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 52
  • Joined: 30-November 04

Posted 19 February 2005 - 12:45 PM

The reason it is not working is because your permissions on your home directory do not allow files to be stored there. I do not recommend getting these changed. The script needs to be modified to allow for storing a backup file on another directory like /home/backup. Any suggestions?

#50 User is offline   canuck 

  • Group: Members
  • Posts: 4
  • Joined: 19-February 05

Posted 19 February 2005 - 09:27 PM

I got it working .... It was my FTP username that was not configured right.

It would be neat to see some code to save only the last 3 days and any older backup files then to be deleted.

Any ideas ?

#51 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 19 February 2005 - 09:39 PM

rowanp, on Feb 15 2005, 08:35 AM, said:

Great script, but I am having the same problem that Billy did, and the answer never seems to have been provided.

The ftp home directory permissions do not allow the backup file to be created there. As I do not wish to change the permissions on the home directory, how can the script be modified so as to upload the backup to a specific directory like /backup for instance?

Thank you.
<{POST_SNAPBACK}>

have you tried creating a folder in the home directory like
/home/backup/
and change its permissions ?


Oh yes welcome to the forum all :)
Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#52 User is offline   canuck 

  • Group: Members
  • Posts: 4
  • Joined: 19-February 05

Posted 20 February 2005 - 07:04 AM

Thing is that where can I tell the FTP to wich directory to store the backup ?

I created a new FTP account and by default the directory is created under the public_html side of things.

With my main FTP account in CPANEL, I have no idea where the default directory is or how can I customize it ?

Need help ! :)

#53 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 20 February 2005 - 11:38 AM

When you log in with your main FTP account yuu are placed in the root folder of your account. That would be "/home/cpanelname"
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#54 User is offline   gemini 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 44
  • Joined: 11-March 03

Posted 02 March 2005 - 12:31 PM

TCH-Bruce, on Feb 20 2005, 10:38 AM, said:

When you log in with your main FTP account yuu are placed in the root folder of your account.  That would be "/home/cpanelname"
<{POST_SNAPBACK}>


I'm trying to back stuff up on my local PC and getting the following email from cron:
/bin/sh: line 1: 30: command not found

what is it? and how do I fix it - any ideas?

Thank you!

#55 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 02 March 2005 - 12:55 PM

What is the cron job you are running?
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#56 User is offline   gemini 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 44
  • Joined: 11-March 03

Posted 02 March 2005 - 01:09 PM

TCH-Bruce, on Mar 2 2005, 11:55 AM, said:

What is the cron job you are running?
<{POST_SNAPBACK}>


the last one was
7 13 * * * /usr/local/bin/php /home/ibsteam/fullbackup.php

the number 30 in the message I figured stands for the minutes in the cron job.
The las message was:
/bin/sh: line 1: 7: command not found

#57 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 02 March 2005 - 01:29 PM

gemini, on Mar 2 2005, 11:09 AM, said:

the last one was
7 13 * * * /usr/local/bin/php /home/ibsteam/fullbackup.php

the number 30 in the message I figured stands for the minutes in the cron job.
The las message was:
/bin/sh: line 1: 7: command not found
<{POST_SNAPBACK}>


It looks like you entered the time arguments as part of the command line (made obvious by the fact it's trying to run '7' as a command). Assuming you are using cPanel's cron form to enter your crontab info, the actual command should be "/usr/local/bin/php /home/ibsteam/fullbackup.php" and you should use the other form fields available to enter the five scheduling components (i.e., if you used the Advanced cron form, you'll see 5 fields before the command line field. Enter the 5 items in "7 13 * * *" in each of those fields respectively).
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#58 User is offline   gemini 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 44
  • Joined: 11-March 03

Posted 02 March 2005 - 02:06 PM

TCH-MikeJ, on Mar 2 2005, 12:29 PM, said:

gemini, on Mar 2 2005, 11:09 AM, said:

the last one was
7 13 * * * /usr/local/bin/php /home/ibsteam/fullbackup.php

the number 30 in the message I figured stands for the minutes in the cron job.
The las message was:
/bin/sh: line 1: 7: command not found
<{POST_SNAPBACK}>


It looks like you entered the time arguments as part of the command line (made obvious by the fact it's trying to run '7' as a command). Assuming you are using cPanel's cron form to enter your crontab info, the actual command should be "/usr/local/bin/php /home/ibsteam/fullbackup.php" and you should use the other form fields available to enter the five scheduling components (i.e., if you used the Advanced cron form, you'll see 5 fields before the command line field. Enter the 5 items in "7 13 * * *" in each of those fields respectively).
<{POST_SNAPBACK}>


Thank you Mike! That's was the problem. Thank you guys a lot for your great support!

#59 User is offline   rowanp 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 52
  • Joined: 30-November 04

Posted 03 March 2005 - 04:19 AM

TCH-Don, on Feb 19 2005, 08:39 PM, said:

rowanp, on Feb 15 2005, 08:35 AM, said:

Great script, but I am having the same problem that Billy did, and the answer never seems to have been provided.

The ftp home directory permissions do not allow the backup file to be created there. As I do not wish to change the permissions on the home directory, how can the script be modified so as to upload the backup to a specific directory like /backup for instance?

Thank you.
<{POST_SNAPBACK}>

have you tried creating a folder in the home directory like
/home/backup/
and change its permissions ?


Oh yes welcome to the forum all :)
<{POST_SNAPBACK}>


I have created a /home/backup directory and changed the permissions, but the problem is getting the backup script to send the backup file to that directory. I don't know how to do that.

Rowan.

#60 User is offline   perdog05 

  • Group: Members
  • Posts: 4
  • Joined: 08-March 05

Posted 08 March 2005 - 10:05 AM

Quote

Can't call method "login" on an undefined value at /usr/local/cpanel/bin/ftpput


Hi,

This thread is getting long, but I'm getting the above error when I try to use this script. Now to be precise, the script works one time and saves a backup to my ftp server running on a home pc. No errors, everything works. I get all the good confrimation e-mails.

But the second time the php file runs as sceduled, I get the above error. I get this on all subsiquent php runs until I reset my ftp server. I've tried two different servers with the exact same behaivior, so I don't believe that is the problem.

The router appears to be configured right because the FTP is going through correctly once. Could the php script not be closing something or reseting something on the server that leaves it in an abnormal state?

The log on the server looks 100% normal with a "GOOD-BYE" at the end of a successful transmission. I'm kind of at a loss here as this script almost works right.

Thanks for any help, and just browsing through the forum here I've learned alot. Very glad I chose Totalchoice to host...

#61 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 08 March 2005 - 10:19 AM

Welcome to the forums perldog5 :)

I'm sure someone will be along to help.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#62 User is offline   brockhosting 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 07-March 05

Posted 16 March 2005 - 01:17 PM

I get this error when I look at the dbsender.php script
"Warning: filetype(): open_basedir restriction in effect"

This is getting very complacated.
I did the chmod and still get the same error.
Cron job wont allways send e-mails but i dont get the fiel via e-mail eather.
Very lost here.

#63 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 16 March 2005 - 01:27 PM

Welcome to the forums brockhosting. :)

Have you checked your default email with webmail? Sometimes the errors get sent there.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#64 User is offline   perdog05 

  • Group: Members
  • Posts: 4
  • Joined: 08-March 05

Posted 16 March 2005 - 01:38 PM

perdog05, on Mar 8 2005, 09:05 AM, said:

Quote

Can't call method "login" on an undefined value at /usr/local/cpanel/bin/ftpput


Hi,

This thread is getting long, but I'm getting the above error when I try to use this script. Now to be precise, the script works one time and saves a backup to my ftp server running on a home pc. No errors, everything works. I get all the good confrimation e-mails.

But the second time the php file runs as sceduled, I get the above error. I get this on all subsiquent php runs until I reset my ftp server. I've tried two different servers with the exact same behaivior, so I don't believe that is the problem.

The router appears to be configured right because the FTP is going through correctly once. Could the php script not be closing something or reseting something on the server that leaves it in an abnormal state?

The log on the server looks 100% normal with a "GOOD-BYE" at the end of a successful transmission. I'm kind of at a loss here as this script almost works right.

Thanks for any help, and just browsing through the forum here I've learned alot. Very glad I chose Totalchoice to host...
<{POST_SNAPBACK}>



All right. I don't have a ton of info to post here, but in the interest of trying to be helpful to everyone, just a quick update. I did nothing to resolve the problem, but the script started working correctly. Then it stopped. Basically, i'd say 75% of the time it works, which isn't great really, but is better than nothing. The other 75% of the time I get the error.

I haven't had a chance to really go through the code, and I'm no expert, but my thought is that 1 of 2 things may be going on.

1- my belkin router is the problem. This is clearly not a professional high quality router, but it is new and seems to work properly. Perhaps occasionally the router doesn't handle the FTP correctly, or fast enough, or something.

2- The script may be at fault. Perhaps it's written properly and should work "on paper" but in practice there is a better way to write the FTP portion that is more universally used.

I'm not trying to knock the script for no reason! It really is a huge help and for all I know it isn't the problem at all, I'm just conjecturing here. If someone who knows the code better than I do tells me I'm totally off base, excellent, we'll have ruled out one of my ideas!

#65 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 16 March 2005 - 05:21 PM

rowanp, on Mar 3 2005, 02:19 AM, said:

I have created a /home/backup directory and changed the permissions, but the problem is getting the backup script to send the backup file to that directory. I don't know how to do that.
<{POST_SNAPBACK}>


I never added a variable for remote directory. I'll try to add that tonight and repost the script.

perdog05, on Mar 16 2005, 11:38 AM, said:

1- my belkin router is the problem. This is clearly not a professional high quality router, but it is new and seems to work properly. Perhaps occasionally the router doesn't handle the FTP correctly, or fast enough, or something.

2- The script may be at fault. Perhaps it's written properly and should work "on paper" but in practice there is a better way to write the FTP portion that is more universally used.
<{POST_SNAPBACK}>


Try running backups manually via cPanel and see if it sometimes fails. The above script itself doesn't do the backup nor the FTP process. All it does it automate calling the cPanel process that does (basically does a form submit). If you are still having the problem running them manually from cPanel, that will help isolate where they problem might lie.

However, cPanel added a "Download Today's Backup" function since I wrote this script, so a simpler way to get your daily backups if you have something like wget on the remote machine is simply to wget the file every day in cron.

An example cron entry (all one line):
0 3 * * * wget -q --http-user="youraccount" --http-password="yourpassword" -O /home/backup/dailybackup.tar.gz https://******:2083/getbackup/


Just change "/home/backup/dailybackup.tar.gz" to the directory and filename you want.

Note that this would be put as a cron on the remote machine, not under your cPanel account, as the machine running the wget will be receiving the file.

You can replace wget with any program (using it's appropriate parameters) that would retrieve and save a URL target.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#66 User is offline   brockhosting 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 07-March 05

  Posted 17 March 2005 - 02:10 PM

I got this to work from one server to another. So it should be fine for off site backups.
Now could some one tell me how I can get this script to "go off" every 6 hours with the cron system?
I keep getting a 404 error.
<?
$user_name = "you_user_name_here";
$user_pass = "your_pass_word_here";
$user_website = "www.your_full_domain_name_here.com";

$db_list = array("phpbb1","rface");
// "Backthisup", "backthisup2"
$looper = 0;

// Do not edit below this line
$dc = time();
while($db_list[$looper] != null) {
$db_name = $db_list[$looper];
$get_this = "http://".$user_name.":".$user_pass."@".$
user_website.":2082/getsqlbackup/".$db_name.".gz";
echo "<br>Atempting to downlaod $db_name";
$handle = fopen($get_this, "r");
 $save_as = "backup_".$db_name."_".$dc."_.gz";
if ($handle != null) {
$local_handle = fopen($save_as,"x");
 echo "<br>Saveing $db_name as $save_as <br>";
while(!feof($handle))
{
   fwrite($local_handle,fgets($handle));
}
}
fclose($handle);
fclose($local_handle);
$looper++;
}
?>


#67 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 17 March 2005 - 03:08 PM

Where are you getting a 404 error? From the cron job? If so, you do not have the correct path to the script in the cron job.

It should be something like this
/usr/bin/php -q /home/cpanelname/path-to-script

Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#68 User is offline   brockhosting 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 07-March 05

Posted 17 March 2005 - 03:33 PM

php /home/brockho/auto_backup/my_backup_system.php

Thats what I have now and it works. :clapping:
Now to try to get it to mail it to me every night.
This fourm took a long time to read but it helped a LOT thanks.

#69 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 17 March 2005 - 06:29 PM

By default cron jobs do not send an email unless there is an error so you will have to write it into your backup script to send you email.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#70 User is offline   brockhosting 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 07-March 05

Posted 17 March 2005 - 07:00 PM

Yeah I got that part I just cant seem to get it to mail me the .gz file.

#71 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 17 March 2005 - 07:40 PM

I would suggest using dbsender and then follow the directions in this thread to configure it.

I use it and it works fine.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#72 User is offline   brockhosting 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 07-March 05

Posted 13 April 2005 - 05:33 PM

This is fast and easy.
I'll post it even though i'm not a TCH client any more because this thread got me to write this script.
Should work great for server to server backups because its FTP.
This can be set up as a one touch backup system or threw a cron job.
<?
// A script produced by BrockHosting.com
// For more help visit http://www.brockhosting.com/bb/viewtopic.php?p=13
$user_name = "not_root"; // YOUR cpanel user name

$user_pass = "password_here"; // YOUR cpanel password
$user_website = "www.brockhosting.com"; // YOUR website do NOT include http://

$ftp_server_ip = "1.2.3.4"; // Server IP here
$ftp_server_user = $user_name."_ftp"; // FTP login name here
$ftp_server_pass = "Hd3Z6wpf"; // FTP password here


$db_list = array("phpbb1","ptp","rcash"); // List of your databases
 // Must be "database1","Database2"
 // DO NOT ENTER "username_database1", "username_database2"


// Do not edit below this line
$dc = time();
$looper = 0;
while($db_list[$looper] != null) {
  $db_name = $db_list[$looper];
  $get_this = "http://".$user_name.":".$user_pass."@".$
user_website.":2082/getsqlbackup/".$db_name.".gz";
  echo "\n<br><br>\nAtempting to downlaod $db_name";
  $handle = fopen($get_this, "r");
   $save_as = "backup_".$db_name."_".$dc."_.gz";
  if ($handle != null) {
    $local_handle = fopen($save_as,"x");
     echo "\n<br>Saveing \"$db_name\" as \"$save_as\" ";
  while(!feof($handle)){ fwrite($local_handle,fgets($handle)); }
  }
  fclose($handle);
  fclose($local_handle);
  // Got file need ftp home
  $ftp_conn_id = ftp_connect($ftp_server_ip) or die("Couldn't connect to $ftp_server_ip");
  ftp_login($ftp_conn_id,$ftp_server_user,$ftp_server_pass)
;
  $upload = ftp_put($ftp_conn_id, $save_as, $save_as, FTP_BINARY);
  if ($upload != null) {
  echo "\n<br>File Sent!\n";
  unlink($save_as);
  } else { 
  echo "\n<br>File NOT SENT!\n";
  }

  $looper++;
}
?>


#73 User is offline   johny_gjx 

  • Group: Members
  • Posts: 2
  • Joined: 29-April 05

Posted 29 April 2005 - 08:30 AM

Hello,

I'm new to the forum and actually I found here and TCH through google when searching for an automated backup. My question is will that be possible to write a similar code to the one discussed in the topic for simulating the act of uploading a gziped backup? I mean a backup which is already made by cpanel is stored somewhere on the web and the php script reads that and simulates the uploading of it to cpanel for restoration.

This post has been edited by johny_gjx: 29 April 2005 - 08:36 AM


#74 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 29 April 2005 - 09:41 AM

Welcome to the forums, johny_gjx :dance:

Sorry, I don't know if that's possible or not.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#75 User is offline   TweezerMan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,767
  • Joined: 26-September 04

Posted 29 April 2005 - 11:40 AM

Welcome to the forums, johny_gjx! :thumbup1:

Is it possible? Sort of. 'Simulating' the upload isn't really useful, as the script would have to upload the entire file anyway in order to read it. Such a script should just retrieve the backup file from the remote server and save it locally so it can then be restored.
David Phillips (TweezerMan)
The Tweezer's Edge v3

#76 User is offline   TCH-Thomas 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 15,685
  • Joined: 01-May 03

Posted 30 April 2005 - 04:40 AM

Welcome to the forum, johny_gjx. :)
Thomas Jikrantz
Forum Moderator
TotalChoice Hosting, L.L.C.

Any links or suggestions for third party software/sites should be used at your own risk. My opinions and recommendations are not necessary those of TCH and TCH is not responsible.

As a Forum Moderator I can assist in answering many of your hosting related questions. However, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

Web Hosting by Total Choice Web Hosting - 24/7 Help Desk

#77 User is offline   johny_gjx 

  • Group: Members
  • Posts: 2
  • Joined: 29-April 05

Posted 30 April 2005 - 05:02 AM

Thank you David and Thomas,

David is right about the fact that it would be better if the script could retrieve the backup from the remote machine, but just in order to make things simpler we can do the transfer by SST:

http://www.jazarsoft...?pid=0090040006

so perhaps if a php coder is going to help, things will be simpler for him, or maybe someone can combine the two pieces of code and make a perfect solution that does the transfer as well :)

#78 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 30 April 2005 - 10:48 AM

Welcome to the forums, johny_gjx :D
Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#79 User is offline   jasmon 

  • Group: Members
  • Posts: 3
  • Joined: 17-June 05

Posted 17 June 2005 - 03:12 PM

TCH-Don, on Apr 30 2005, 10:48 AM, said:

Welcome to the forums, johny_gjx :D
<{POST_SNAPBACK}>


Great script, now I have to get it to work,

this is the error which i get,
/bin/sh: line 1: /usr/local/bin/php/home/klei0404/fullbackup.php: Not a directory


if i take out the first part, and have only /home/klei0404/fullbackup.php, which is the absolute path to the this script.

i get (only part of the error)
home/klei0404/fullbackup.php: line 1: ?php
: No such file or directory
/home/klei0404/fullbackup.php: line 2: 
: command not found
/home/klei0404/fullbackup.php: line 3: //: is a directory
/home/klei0404/fullbackup.php: line 4: //: is a directory
/home/klei0404/fullbackup.php: line 5: //: is a directory


any suggestions?
Thanks
Jasmon

#80 User is offline   TCH-Thomas 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 15,685
  • Joined: 01-May 03

Posted 17 June 2005 - 03:15 PM

Sorry Jasmon, I don´t know the answer to this but...

Welcome to the forum. :)
Thomas Jikrantz
Forum Moderator
TotalChoice Hosting, L.L.C.

Any links or suggestions for third party software/sites should be used at your own risk. My opinions and recommendations are not necessary those of TCH and TCH is not responsible.

As a Forum Moderator I can assist in answering many of your hosting related questions. However, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

Web Hosting by Total Choice Web Hosting - 24/7 Help Desk

#81 User is offline   jasmon 

  • Group: Members
  • Posts: 3
  • Joined: 17-June 05

Posted 17 June 2005 - 03:18 PM

TCH-Thomas, on Jun 17 2005, 03:15 PM, said:

Sorry Jasmon, I don´t know the answer to this but...

Welcome to the forum. :)
<{POST_SNAPBACK}>



thanks anyway!

#82 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 17 June 2005 - 03:45 PM

Welcome to the forums Jasmon :dance:

Try:
/usr/bin/php -q /home/klei0404/fullbackup.php


This is assuming that the fullbackup.php file resides above your public_html folder. Otherwise enter the full path to the script.


Edit: changed path to php
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#83 User is offline   TweezerMan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,767
  • Joined: 26-September 04

Posted 17 June 2005 - 03:53 PM

Welcome to the forums, Jasmon! :thumbup1:
David Phillips (TweezerMan)
The Tweezer's Edge v3

#84 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 17 June 2005 - 06:13 PM

Welcome to the forums, Jasmon :D
Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#85 User is offline   TCH-RobertM 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,238
  • Joined: 03-November 04

Posted 17 June 2005 - 08:05 PM

Hello jasmon,

send me a message with the script and I will be happy to look at it for you.

#86 User is offline   jasmon 

  • Group: Members
  • Posts: 3
  • Joined: 17-June 05

Posted 18 June 2005 - 01:51 AM

TCH-RobertM, on Jun 17 2005, 08:05 PM, said:

Hello jasmon,

send me a message with the script and I will be happy to look at it for you.
<{POST_SNAPBACK}>


great,

actually, i'm using the script mentioned in this thread (reply # 4)

I just copied and pasted into a new document which I uploaded to the server.

First I will give it a new shot!

#87 User is offline   jwbowden 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 104
  • Joined: 24-January 05

Posted 25 September 2005 - 07:21 PM

I've been using this script for some time now. What I've found is that the files generated by this script are evidently not owned by my account. When they're created they have permissions of 600 and I'm not able to chmod them or to ftp them down to my pc.

Anyone have any idea why this would be so? (I'm using my cpanel id/pwd in the script of course).

Thanks,
John
John Bowden
Visit My Blog - part of St Blog's Parish

#88 User is offline   TweezerMan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,767
  • Joined: 26-September 04

Posted 25 September 2005 - 11:49 PM

From what I understand, it should not be happening. I'd be curious to know what user owns the files, what user owns the directory containing the files, and the permissions on that directory.
David Phillips (TweezerMan)
The Tweezer's Edge v3

#89 User is offline   jwbowden 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 104
  • Joined: 24-January 05

Posted 26 September 2005 - 08:29 PM

View PostTCH-David, on Sep 26 2005, 12:49 AM, said:

From what I understand, it should not be happening. I'd be curious to know what user owns the files, what user owns the directory containing the files, and the permissions on that directory.


Well, here's what my FTP tool's dirinfo cmd reveals:

drwxr-xr-x 2 stblogs stblogs 4096 Jul 26 19:06 albums
-rwx------ 1 stblogs stblogs 21598 Jul 18 17:28 automysqlbackup.sh
-rw------- 1 root wheel 28865662 Sep 18 05:01 backup-9.18.2005_01-00-07_stblogs.tar.gz
-rw------- 1 root wheel 30227104 Sep 25 05:02 backup-9.25.2005_01-00-24_stblogs.tar.gz
drwxrwxrwx 5 stblogs stblogs 4096 Sep 26 05:00 backups
-rw-r--r-- 1 stblogs stblogs 119 Jul 29 21:03 error_log
drwxr-x--- 3 stblogs (?) 4096 Jul 17 15:33 etc
-rwx------ 1 stblogs stblogs 2284 Sep 13 19:09 fullbackup.php
drwx------ 2 stblogs stblogs 4096 Aug 30 13:17 logs
drwxrwx--- 3 stblogs (?) 4096 Sep 27 01:10 mail
drwxr-x--- 3 stblogs stblogs 4096 Jan 24 2005 public_ftp
drwxr-x--- 13 stblogs (?) 4096 Sep 26 01:32 public_html
-rwxr--r-- 1 stblogs stblogs 27 Feb 16 2005 robots.txt
drwx------ 6 stblogs stblogs 4096 Jan 26 2005 tmp
lrwxrwxrwx 1 root (?) 11 Jan 24 2005 www -> public_html

here's the script:

<?php

// PHP script to allow periodic cPanel backups automatically.
// Based on script posted by max.hedroom in cpanel.net forums
// This script contains passwords. KEEP ACCESS TO THIS FILE SECURE!

// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********

// Info required for cPanel access
$cpuser = "********"; // Username used to login to CPanel
$cppass = "********"; // Password used to login to CPanel
$domain = "stblogsparish.com"; // Domain name where CPanel is run
$skin = "bluelagoon"; // Set to cPanel skin you use (script won't work if it doesn't match)

// Info required for saving locally
$savedir = "/home/stblogs/"; //Save to this directory

// Info required for FTP host
$ftpuser = "********"; // Username for FTP account
$ftppass = "********"; // Password for FTP account
$ftphost = "xxx.xxx.xxx.xxx"; // Full hostname or IP address for FTP host
$ftpmode = "ftp"; // FTP mode ("ftp" for active, "passiveftp" for passive)

// Notification information
$notifyemail = "myemailaddresshere"; // Email address to send results

// Secure or non-secure mode
$secure = 0; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP

// Set to 1 to have web page result appear in your cron log
$debug = 0;

// *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********

if ($secure) {
$url = "ssl://".$domain;
$port = 2083;
} else {
$url = $domain;
$port = 2082;
}

$socket = fsockopen($url,$port);
if (!$socket) { echo "Failed to open socket connection... Bailing out!\n"; exit; }

// Encode authentication string
$authstr = $cpuser.":".$cppass;
$pass = base64_encode($authstr);

//$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ ftpuser&pass=$ftppass&submit=Generate Backup";
$params = "dest=$savedir&email=$notifyemail&user=$ftpuser&pass=$ ftppass&submit=Generate Backup";

// Make POST to cPanel
fputs($socket,"POST /frontend/".$skin."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
fputs($socket,"Host: $domain\r\n");
fputs($socket,"Authorization: Basic $pass\r\n");
fputs($socket,"Connection: Close\r\n");
fputs($socket,"\r\n");

// Grab response even if we don't do anything with it.
while (!feof($socket)) {
$response = fgets($socket,4096);
if ($debug) echo $response;
}

fclose($socket);

?>

and here's the cron command line:

0 01 * * 7 /usr/bin/php /home/stblogs/fullbackup.php


Think I need to ticket this or could it be something I'm doing?
John Bowden
Visit My Blog - part of St Blog's Parish

#90 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 27 September 2005 - 07:05 AM

Quote

// Info required for saving locally
$savedir = "/home/stblogs/"; //Save to this directory


This should be (I believe):

// Info required for saving locally
$savedir = "/home/your-TCH-cpanel-name/stblogs/"; //Save to this directory
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#91 User is offline   TweezerMan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,767
  • Joined: 26-September 04

Posted 27 September 2005 - 04:25 PM

'stblogs' is the cpanel name. I believe the backups should be going into the 'backups' subdirectory, which has been set up with 0777 permissions presumably for this purpose:
// Info required for saving locally
$savedir = "/home/stblogs/backups/"; //Save to this directory

David Phillips (TweezerMan)
The Tweezer's Edge v3

#92 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 27 September 2005 - 05:12 PM

Quote

$skin = "bluelagoon"; // Set to cPanel skin you use (script won't work if it doesn't match)

I don't think anyone has the bluelagoon theme anymore
I think it should be x2 ?
Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#93 User is online   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 21,848
  • Joined: 11-August 03

Posted 27 September 2005 - 05:50 PM

View PostTCH-David, on Sep 27 2005, 05:25 PM, said:

'stblogs' is the cpanel name. I believe the backups should be going into the 'backups' subdirectory, which has been set up with 0777 permissions presumably for this purpose:
// Info required for saving locally
$savedir = "/home/stblogs/backups/"; //Save to this directory


Thanks David, I knew I was incorrect. :goof:
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#94 User is offline   jwbowden 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 104
  • Joined: 24-January 05

Posted 27 September 2005 - 06:08 PM

View PostTCH-Don, on Sep 27 2005, 06:12 PM, said:

I don't think anyone has the bluelagoon theme anymore
I think it should be x2 ?


I took 'bluelagoon' from the URL I use to access cpanel: http://65.254.50.74:...goon/index.html

I could certainly TRY using 'x2' - ya never know!
John Bowden
Visit My Blog - part of St Blog's Parish

#95 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 27 September 2005 - 06:18 PM

No if thats what you have don't change it.
Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#96 User is offline   jwbowden 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 104
  • Joined: 24-January 05

Posted 27 September 2005 - 06:18 PM

View PostTCH-David, on Sep 27 2005, 05:25 PM, said:

'stblogs' is the cpanel name. I believe the backups should be going into the 'backups' subdirectory, which has been set up with 0777 permissions presumably for this purpose:
// Info required for saving locally
$savedir = "/home/stblogs/backups/"; //Save to this directory


it doesn't seem to matter, believe it or not, whether I use '/home/stblogs/' or '/home/stblogs/backups/' - the file is written to the root of /home and permission 600

Running with '/home/stblogs/backup/' and using 'x2' as the theme name the job doesn't seem to do anything - I get no email regarding failure or success.


and thanks to all for responding . . .
John Bowden
Visit My Blog - part of St Blog's Parish

#97 User is offline   TCH-MikeJ 

  • Big Gorilla
  • PipPipPipPip
  • Group: Moderators
  • Posts: 2,380
  • Joined: 21-January 04

Posted 27 September 2005 - 06:57 PM

View Postjwbowden, on Sep 26 2005, 08:29 PM, said:

// Info required for saving locally
$savedir = "/home/stblogs/"; //Save to this directory

$params = "dest=$savedir&email=$notifyemail&user=$ftpuser&pass=$ ftppass&submit=Generate Backup";


Valid values for the "dest" parameter are homedir, ftp, ftppassive, and scp.

So if you only want to do a local backup, in your modified script set $savedir to homedir (as in $savedir="homedir" literally, not to "/home/stblogs/") and try that (or in my original script, just set $ftpmode to homedir and leave the other $ftp variables blank).

If you still have a problem, do a backup manually through your control panel and see if you still are getting backup files not owned by you (and if so, open a help desk ticket). On my own server I'm not able to reproduce that problem.
Mike Jones, Lurking Guru
TotalChoice Hosting, L.L.C.

Have a dedicated server? Make sure to visit the Dedicated Server Talk forum for customer-to-customer support and the TCHNOC Dedicated Servers forum for announcements!

Twitter | Plurk

#98 User is offline   jwbowden 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 104
  • Joined: 24-January 05

Posted 29 September 2005 - 09:48 AM

View PostTCH-MikeJ, on Sep 27 2005, 07:57 PM, said:

Valid values for the "dest" parameter are homedir, ftp, ftppassive, and scp.

So if you only want to do a local backup, in your modified script set $savedir to homedir (as in $savedir="homedir" literally, not to "/home/stblogs/") and try that (or in my original script, just set $ftpmode to homedir and leave the other $ftp variables blank).

If you still have a problem, do a backup manually through your control panel and see if you still are getting backup files not owned by you (and if so, open a help desk ticket). On my own server I'm not able to reproduce that problem.


Changing the $savedir param did the trick. Thank you so much for responding. I was pretty sure it was something I had messed up - sure 'nuff!

Thanks to all - :tchrocks!:
John Bowden
Visit My Blog - part of St Blog's Parish

#99 User is offline   MarkMan 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 23
  • Joined: 04-November 05

Posted 05 November 2005 - 05:24 AM

Excellent! I just got this thing working also.

Suggestion:
Edit the script at the beginning of this thread with the tweak above, so that one does not have to wade through this very long thread to get it running properly.

Better yet, update the Help file listed waaaaaay above to access the final script so, again, one needn't get lost in this thread trying to figure out the correct script.

Just trying to help out the next person that tries to get this set up, especially since it is worthy of being listed in 'Help' :thumbup:

#100 User is offline   noveltech 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 13
  • Joined: 26-December 04

Posted 05 November 2005 - 05:33 PM

Cron job email states: No input file specified.

Need help to correct. all feedback welcomed. thanks, nt

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users