#1 (permalink)  
Old 06-29-2009, 09:28 PM
CJL CJL is offline
Registered User
 
Join Date: Jun 2009
Posts: 9
CJL is on a distinguished road
Auto Backup Script

Hi,

I am sure a number of people out there use Justin Cooks backup up cron script, my question is am getting an email sent me to me once cpanel tries to run the cron job and I am not sure what it means. I am guess it means it cant access the ftp that I wont it to send the backup to, but could someone clarify this please.

The email response from cron contains the following;
/bin/sh: /home/username/public_html/sender.php: Permission denied


Below is the script that I am using, is it correct? it was quiet straight forward so I assume it is;

PHP Code:
<?php

// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
// This script contains passwords.  KEEP ACCESS TO THIS FILE SECURE! (place it in your home dir, not /www/)

// ********* 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 "domain.com.au"// Domain name where CPanel is run
$skin "x"// Set to cPanel skin you use (script won't work if it doesn't match). Most people run the default x theme

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

// Notification information
$notifyemail "myemail@domain.com.au"// 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);

?>
Thank you.....

Last edited by Infopro; 06-29-2009 at 10:02 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-29-2009, 10:42 PM
anoopkumar's Avatar
Registered User
 
Join Date: Feb 2004
Location: India
Posts: 6
anoopkumar
/bin/sh: /home/username/public_html/sender.php: Permission denied

That does not appear to be an issue with the script. Looks like you have setup the php script /home/username/public_html/sender.php wrongly in the cronjob.

It should be like

php /home/username/public_html/sender.php

If you just give /home/username/public_html/sender.php, system will try to execut it as a shell script, which caused the above error.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-29-2009, 10:56 PM
CJL CJL is offline
Registered User
 
Join Date: Jun 2009
Posts: 9
CJL is on a distinguished road
Thank you for the speedy reply anoopkumar

I will give it a shot....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-30-2009, 03:58 AM
CJL CJL is offline
Registered User
 
Join Date: Jun 2009
Posts: 9
CJL is on a distinguished road
Ok my cron job just ran now and I received this feedback via email

X-Powered-By: PHP/5.2.9
Content-type: text/html

It didnt actually do anything, it was meant to perform a backup and send it to my hosting account...

Does anyone know what the problem is???

cheers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-30-2009, 10:38 AM
serversphere's Avatar
Registered User
 
Join Date: Jan 2004
Posts: 652
serversphere is on a distinguished road
If you don't set up the script to send the output from the PHP script to null, it will likely email it to you (you probably set up an email address when setting up the cron job, right?)

If it didn't actually do anything, check the directory where it is running for an error_log file and see what it says is wrong.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-01-2009, 03:03 AM
CJL CJL is offline
Registered User
 
Join Date: Jun 2009
Posts: 9
CJL is on a distinguished road
Quote:
Originally Posted by serversphere View Post
If you don't set up the script to send the output from the PHP script to null, it will likely email it to you (you probably set up an email address when setting up the cron job, right?)

If it didn't actually do anything, check the directory where it is running for an error_log file and see what it says is wrong.
Unfortunately there was no error log present so I don’t think it was actually running what so ever for an error to occur. Therefore I made some changes to script and got the following error which tells me it is at least running. I believe this error was caused by setting the script to passiveftp. But I have changed that and rescheduled it to run later today. I will let you know how it goes.

X-Powered-By: PHP/5.2.9
Content-type: text/html

<br />
<b>Warning</b>: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to http://www.domain.com.au:2082 (Unable to find the socket transport &quot;http&quot; - did you forget to enable it when you configured PHP?) in <b>/home/username/public_html/sender.php</b> on line <b>39</b><br /> Failed to open socket connection Bailing out!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-03-2009, 01:30 AM
CJL CJL is offline
Registered User
 
Join Date: Jun 2009
Posts: 9
CJL is on a distinguished road
Has anyone managed to get the Justin Cook backup automation script to actually work? who could advise me on what on earth is going on.

A summary of the issues I am facing are:
  • It seems that the cron job is running but it does not seem to actually do anything. It does not do a backup and/or send it to my alternative ftp account.
  • I receive the following information in an email but I do not understand what it means.

X-Powered-By: PHP/5.2.9
Content-type: text/html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WHM Auto Script MeGaMASTER cPanel and WHM Discussions 12 11-30-2009 03:27 AM
auto backup and delete old backup peakman cPanel Newbies 1 01-08-2007 03:53 PM
Help! I need script for Auto Backup for SQL jeepj27 cPanel and WHM Discussions 1 09-12-2006 07:45 PM
WHM Auto script... *asterisk* cPanel and WHM Discussions 6 09-23-2005 12:31 PM
Auto Restart Script Netsender cPanel and WHM Discussions 1 07-07-2004 01:18 PM


All times are GMT -5. The time now is 09:03 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc