Welcome Guest, Not a member yet? Register   Sign In
Just discovered how to utilise RSYNC to eliminate FileZilla

(This post was last modified: 03-22-2019, 07:28 AM by John_Betong. Edit Reason: formatting problems )

Just discovered how to utilise RSYNC to eliminate FileZilla

For years I have laboriously written code on my Localhost then used FileZilla to update the relevant Server files. 

Although FileZilla is very good it does take quite a few clicks to synchonise all the updated files so... eventually got round to trying RSYNC.  Updating changes now only takes a couple of seconds!!! FileZilla is never used!!!

The web-page update links and function can be used on any CodeIgniter installation.

The following prerequisites does take a bit of trial and error to install but the effort is well rewarded. 


1. install RSYNC
2. install Linux SSH
3. Localhost mirror image of the Server files 
4. Upload links on home page banner/footer (only on Localhost web-pages) 

Test for the following GET parameter links:

1. https://my-ci-website.com/web-page?rsync=app 
2. https://my-ci-website.com/web-page?rsync=wri
3. https://my-ci-website.com/web-page?rsync=ass

The main controller tests for above links and if true calls the following function:

PHP Code:
// Controller Web_page

$rsync = isset($_GET['rsync']) ? $_GET['rsync'] : false;
$data['updatedFiles'] = '';
LOCALHOST && $rsync):
$updatedFiles $this->rsync($rsync$DEBUG=TRUE);
'<pre>' .print_r($updatedFilesTRUE) .'</pre>';
$data['updatedFiles'] = $updatedFiles;


// ===========================================================
private function rsync
string $rsync ''
$result '';

$HERE  '/var/www/my-ci-website.com/';
$THERE '[email protected]:';

$HERE .= 'writable/';

$HERE .= 'public_html/assets/';

// case 'app':
$HERE 'app/'// application for CI3.??

$USER   'ssh-root-user';  
$PWORD  'ssh-password';
// START - PHP HereDoc syntax  
$tmp = <<< ____EOT
     /usr/bin/rsync -vratlz      \
     --progress \
     --rsh="/usr/bin/sshpass -p  \
$PWORD ssh -o               \
     StrictHostKeyChecking=no -l \
$USER" \
// FINISH - PHP HereDoc syntax  

  // call RSYNC and get parameters by reference

// Maybe DEBUG - return updated files
$result $aRefFilesUploaded;   

// endfunc 

Messages In This Thread
Just discovered how to utilise RSYNC to eliminate FileZilla - by John_Betong - 03-22-2019, 07:16 AM

Theme © iAndrew 2016 - Forum software by © MyBB