Skip to content

Instantly share code, notes, and snippets.

@adrienbrault
Created January 7, 2013 10:36
Show Gist options
  • Save adrienbrault/4474003 to your computer and use it in GitHub Desktop.
Save adrienbrault/4474003 to your computer and use it in GitHub Desktop.
<?php
if ($argc != 2) {
die('Usage: cd ~/Developer/FSCV2 && php rsync.php <remote_path>');
}
$user = 'vagrant';
$host = 'fsc.local';
$localPath = getcwd() . '/';
$remotePath = $argv[1];
passthru(sprintf('ssh %s@%s "sudo chown -R vagrant:vagrant %s"', $user, $host, $remotePath));
passthru(sprintf('rsync -a --stats --exclude=".git" --delete "%s" %s@%s:%s', $localPath, $user, $host, $remotePath));
$cmds = array(
sprintf('cd %s', $remotePath),
'mkdir -p app/{cache,logs}',
'sudo setfacl -R -m u:www-data:rwx -m u:vagrant:rwx app/{cache,logs}',
'sudo setfacl -dR -m u:www-data:rwx -m u:vagrant:rwx app/{cache,logs}'
);
passthru(sprintf('ssh %s@%s "%s"', $user, $host, join("\n ", $cmds)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment