Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #21  
Old 20th June 2008, 16:01
hmfireball hmfireball is offline
Junior Member
 
Join Date: May 2008
Location: Nancy, France
Posts: 27
Thanks: 0
Thanked 4 Times in 3 Posts
Default

That depends on the FTP client you use and what you want to do.
In a web browser, typing ftp://(server.ip)/folder/folder/ should list the content of folder/folder/
Is this what you wanted to know?

Henri
Reply With Quote
Sponsored Links
  #22  
Old 20th June 2008, 16:33
gjcomputer gjcomputer is offline
Member
 
Join Date: Jan 2006
Location: missouri, USA
Posts: 91
Thanks: 15
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by hmfireball View Post
That depends on the FTP client you use and what you want to do.
In a web browser, typing ftp://(server.ip)/folder/folder/ should list the content of folder/folder/
Is this what you wanted to know?

Henri


henri, you have a pm
__________________
6r36.com
Reply With Quote
  #23  
Old 20th June 2008, 17:54
hmfireball hmfireball is offline
Junior Member
 
Join Date: May 2008
Location: Nancy, France
Posts: 27
Thanks: 0
Thanked 4 Times in 3 Posts
Default

You're right GJ, I forgot to explain something about the script

By default, the script will create a folder for each web (web1, web2, web3, etc.) in the root folder of your FTP account

This is suitable for my case but it might not be for yours.

Here's a new version that allows you to define the path to the folder where you
want the web folders to be created:

PHP Code:
// HENRI Version 3
set_time_limit(0);

include(
"/root/ispconfig/scripts/lib/config.inc.php");
include(
"/root/ispconfig/scripts/lib/server.inc.php");

if(
$go_info["server"]["do_automated_backups"] != 1) die();

// Erstelle Namen für Backup Datei
$backup_file_name "backup_".date("Y_m_d",time()).".zip";

// HENRI
define('FTP_SERVER''xxxxxx');
define('FTP_USER_NAME''xxxxxxx');
define('FTP_USER_PASS''xxxxxxxxx');
define('FTP_PATH'''); // the path to the folder where backup files will be stored. e.g. '/my/folder' (no slash at the end)
                        // leave it empty to store backup files in the root folder of the FTP account
define('FTP_DAYS'20); // the script will keep FTP backups this number of days. Min value is 1.

// set old_backup_file_name
$old_time mktime(000date('m'), date('d') - FTP_DAYSdate('Y'));
$old_backup_file_name 'backup_'.date('Y_m_d'$old_time).'.zip';
//~HENRI


// [...]


                // Delete temp file
                
exec("rm -rf $tmp_dir");
                
                
// HENRI Send file to FTP server
                
send_backup($web_id$backup_dir);
                
//~HENRI

}

// All web site
$webs $mod->db->queryAllRecords("SELECT * FROM isp_isp_web");
if(!empty(
$webs)){
  foreach(
$webs as $web){
    
do_backup($web['doc_id']);
  }
}

// HENRI
function send_backup($web_id$backup_dir) {
    global 
$backup_file_name$old_backup_file_name;
    
    
// Connect and login to FTP server
    
$conn_id = @ftp_connect(FTP_SERVER);
    
$login_result = @ftp_login($conn_idFTP_USER_NAMEFTP_USER_PASS);
    if (!
$conn_id || !$login_result) {
        echo 
"FTP connection failed for ".FTP_USER_NAME."!\n";
        return 
false;
    }
    else {
        echo 
FTP_USER_NAME." connected\n";
    }
    
    
// Create web_dir if necessary
    
$web_dir FTP_PATH.'/web'.$web_id;
    if (@
ftp_mkdir($conn_id$web_dir)) {
        echo 
"Created $web_dir\n";
    }
    
    
// Upload backup
    
$destination_file $web_dir.'/'.$backup_file_name;
    
$source_file $backup_dir.'/'.$backup_file_name;
    
$uploaded = @ftp_put($conn_id$destination_file$source_fileFTP_BINARY);
    
    
// Display result
    
if (!$uploaded) {
        echo 
"Failed sending $destination_file\n";
    }
    else {
        echo 
"Successed sending $destination_file\n";
        
        
// Remove old backup
        
$destination_file $web_dir.'/'.$old_backup_file_name;
        if (@
ftp_delete($conn_id$destination_file)) {
            echo 
"Removed old backup: $destination_file\n";
        }
    }
    
    
// Close FTP connection
    
@ftp_close($conn_id);
    
    return 
$uploaded;
}
//~HENRI 


In your case, you should write :

PHP Code:
define('FTP_SERVER''XXX.XXX.XXX.XXX'); // replace by the real IP
define('FTP_USER_NAME''xxxxxxx');
define('FTP_USER_PASS''xxxxxxxxx');
define('FTP_PATH''/array1/web'); // no slash at the end 


It should work

Henri
Reply With Quote
The Following User Says Thank You to hmfireball For This Useful Post:
gjcomputer (20th June 2008)
  #24  
Old 20th June 2008, 19:54
gjcomputer gjcomputer is offline
Member
 
Join Date: Jan 2006
Location: missouri, USA
Posts: 91
Thanks: 15
Thanked 2 Times in 2 Posts
Default

it sure did! thanks Henri, you helped me to do exactly what i have been trying to accomplish for at least a year. your modification should make it into ispconfig3! at the very least, you should be promoted to developer, you know what your doing. thanks again
__________________
6r36.com
Reply With Quote
  #25  
Old 20th June 2008, 20:53
hmfireball hmfireball is offline
Junior Member
 
Join Date: May 2008
Location: Nancy, France
Posts: 27
Thanks: 0
Thanked 4 Times in 3 Posts
 
Default

Very happy it was useful to you too
Maybe this feature is already in ISPConfig3.
Does somebody know?

Henri
Reply With Quote
Reply

Bookmarks

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I love ISPConfig rafael-ec General 0 9th August 2007 18:09
Ispconfig update problems from 2.4 to 2.6 adrenalinic Installation/Configuration 23 7th September 2006 12:58
4 questions about ispconfig and domains, please help! dimas Installation/Configuration 7 1st August 2006 11:55
Migrating from Virtualmin to ISPConfig xare Installation/Configuration 3 16th July 2006 12:58
ISPConfig Backups SleeperZ Feature Requests 0 9th November 2005 09:36


All times are GMT +2. The time now is 03:07.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.