Created
January 7, 2013 10:36
-
-
Save adrienbrault/4474003 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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