Cronjob Of Cpanel Backup
#1
Posted 16 February 2004 - 04:41 PM
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
Posted 16 February 2004 - 11:32 PM
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!
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.
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
#4
Posted 17 February 2004 - 03:38 PM
<?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);
?>
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
#7
Posted 26 February 2004 - 11:53 PM
#8
Posted 22 March 2004 - 10:42 AM
Get this error when I tried to download the PHP script from the instructions page today:
Quote
Failed to open socket connection... Bailing out!
Yikes!
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

</div></span></span></span>
#9
Posted 22 March 2004 - 11:41 AM
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.
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
Posted 22 March 2004 - 11:57 AM
TCH-MikeJ, on Mar 22 2004, 11:41 AM, said:
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 ....
help!
!!blue

</div></span></span></span>
#11
Posted 22 March 2004 - 12:24 PM
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.
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
Posted 13 April 2004 - 05:40 PM
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
Posted 13 April 2004 - 10:47 PM
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.
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
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:
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.
Once I finish my last minute tax stuff I'll get to it.
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
Posted 13 April 2004 - 11:34 PM
robnelli, on Apr 13 2004, 05:40 PM, said:
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?
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
Posted 15 April 2004 - 07:49 AM
#17
Posted 15 April 2004 - 07:07 PM
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
Posted 16 April 2004 - 10:26 AM
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
Posted 16 April 2004 - 05:47 PM
#20
Posted 18 April 2004 - 09:59 PM
For the theme variable, what is the correct data for the X theme (X, xtheme....) ?
#21
Posted 19 April 2004 - 08:49 AM
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.
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
Posted 20 April 2004 - 06:42 PM
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
Posted 29 April 2004 - 08:11 PM
#24
Posted 12 May 2004 - 09:23 AM
thanks in advance
#25
Posted 12 May 2004 - 10:37 AM
You should have received an email, however, at your $notifyemail address if you defined it, from the cpanel backup process.
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
Posted 21 May 2004 - 02:20 AM
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
Posted 28 May 2004 - 02:29 PM
Andy
#28
Posted 28 June 2004 - 10:35 PM
!!blue, on Mar 22 2004, 10:42 AM, said:
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.
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
Posted 03 July 2004 - 08:43 PM
1 question :
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?
and then 6 hours after that and 6 hours after that ?
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
Posted 04 July 2004 - 01:09 AM
So if you set it to run every 6 hours, it will run at 0600, noon, 1800, and midnite.
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
Posted 12 July 2004 - 05:35 PM
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
Posted 12 July 2004 - 05:40 PM
To do individual directories would require a something completey different.
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
Posted 05 August 2004 - 01:02 AM
Thanks,
MePH
#34
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:
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.
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
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
Posted 23 September 2004 - 10:30 AM
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
Posted 23 September 2004 - 07:04 PM
#37
Posted 24 September 2004 - 10:10 AM
lubox.com, on Sep 23 2004, 10:30 AM, said:
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.
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
Posted 13 October 2004 - 04:50 PM
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
Posted 13 October 2004 - 04:59 PM
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
Posted 13 October 2004 - 05:16 PM
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
Posted 13 October 2004 - 05:54 PM
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
Posted 13 October 2004 - 06:10 PM
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
Posted 01 February 2005 - 01:00 PM
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
Posted 01 February 2005 - 01:16 PM
Glad you are finding useful information here.
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
Posted 15 February 2005 - 08:35 AM
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
Posted 19 February 2005 - 09:29 AM
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
Posted 19 February 2005 - 10:15 AM
The error message denotes a permission error.
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.
#49
Posted 19 February 2005 - 12:45 PM
#50
Posted 19 February 2005 - 09:27 PM
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
Posted 19 February 2005 - 09:39 PM
rowanp, on Feb 15 2005, 08:35 AM, said:
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
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
Posted 20 February 2005 - 07:04 AM
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
Posted 20 February 2005 - 11:38 AM
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
Posted 02 March 2005 - 12:31 PM
TCH-Bruce, on Feb 20 2005, 10:38 AM, said:
<{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
Posted 02 March 2005 - 12:55 PM
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
Posted 02 March 2005 - 01:09 PM
TCH-Bruce, on Mar 2 2005, 11:55 AM, said:
<{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
Posted 02 March 2005 - 01:29 PM
gemini, on Mar 2 2005, 11:09 AM, said:
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).
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
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:
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
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:
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
Posted 08 March 2005 - 10:05 AM
Quote
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
Posted 08 March 2005 - 10:19 AM
I'm sure someone will be along to help.
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
Posted 16 March 2005 - 01:17 PM
"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
Posted 16 March 2005 - 01:27 PM
Have you checked your default email with webmail? Sometimes the errors get sent there.
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
Posted 16 March 2005 - 01:38 PM
perdog05, on Mar 8 2005, 09:05 AM, said:
Quote
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
Posted 16 March 2005 - 05:21 PM
rowanp, on Mar 3 2005, 02:19 AM, said:
<{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:
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.
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
Posted 17 March 2005 - 02:10 PM
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
Posted 17 March 2005 - 03:08 PM
It should be something like this
/usr/bin/php -q /home/cpanelname/path-to-script
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
Posted 17 March 2005 - 03:33 PM
Thats what I have now and it works.
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
Posted 17 March 2005 - 06:29 PM
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
Posted 17 March 2005 - 07:00 PM
#71
Posted 17 March 2005 - 07:40 PM
I use it and it works fine.
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
Posted 13 April 2005 - 05:33 PM
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
Posted 29 April 2005 - 08:30 AM
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
Posted 29 April 2005 - 09:41 AM
Sorry, I don't know if that's possible or not.
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
Posted 29 April 2005 - 11:40 AM
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.
The Tweezer's Edge v3
#76
Posted 30 April 2005 - 04:40 AM
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
Posted 30 April 2005 - 05:02 AM
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
Posted 30 April 2005 - 10:48 AM
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
Posted 17 June 2005 - 03:12 PM
TCH-Don, on Apr 30 2005, 10:48 AM, said:
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
Posted 17 June 2005 - 03:15 PM
Welcome to the forum.
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
#82
Posted 17 June 2005 - 03:45 PM
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
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
Posted 17 June 2005 - 03:53 PM
The Tweezer's Edge v3
#84
Posted 17 June 2005 - 06:13 PM
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
Posted 17 June 2005 - 08:05 PM
send me a message with the script and I will be happy to look at it for you.
#86
Posted 18 June 2005 - 01:51 AM
TCH-RobertM, on Jun 17 2005, 08:05 PM, said:
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
Posted 25 September 2005 - 07:21 PM
Anyone have any idea why this would be so? (I'm using my cpanel id/pwd in the script of course).
Thanks,
John
#88
Posted 25 September 2005 - 11:49 PM
The Tweezer's Edge v3
#89
Posted 26 September 2005 - 08:29 PM
TCH-David, on Sep 26 2005, 12:49 AM, said:
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?
#90
Posted 27 September 2005 - 07:05 AM
Quote
$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
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
Posted 27 September 2005 - 04:25 PM
// Info required for saving locally $savedir = "/home/stblogs/backups/"; //Save to this directory
The Tweezer's Edge v3
#92
Posted 27 September 2005 - 05:12 PM
Quote
I don't think anyone has the bluelagoon theme anymore
I think it should be x2 ?
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
Posted 27 September 2005 - 05:50 PM
TCH-David, on Sep 27 2005, 05:25 PM, said:
// Info required for saving locally $savedir = "/home/stblogs/backups/"; //Save to this directory
Thanks David, I knew I was incorrect.
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
Posted 27 September 2005 - 06:08 PM
TCH-Don, on Sep 27 2005, 06:12 PM, said:
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!
#95
Posted 27 September 2005 - 06:18 PM
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
Posted 27 September 2005 - 06:18 PM
TCH-David, on Sep 27 2005, 05:25 PM, said:
// 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 . . .
#97
Posted 27 September 2005 - 06:57 PM
jwbowden, on Sep 26 2005, 08:29 PM, said:
$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.
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
Posted 29 September 2005 - 09:48 AM
TCH-MikeJ, on Sep 27 2005, 07:57 PM, said:
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 -
#99
Posted 05 November 2005 - 05:24 AM
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'
#100
Posted 05 November 2005 - 05:33 PM
Need help to correct. all feedback welcomed. thanks, nt

Help














