Andrew Fletcher published: 13 January 2022 (updated) 6 August 2023 2 minutes read
This page will be a progressive outline of moving those regular run scripts that really need to be automated. Or triggered by a keyword.
These scripts are rsync commands
The initial scripts
production environment
sudo rsync -aur staging/{project}/config drupal
cd drupal
sudo chown -R www-data:www-data config
cd ..
sudo rsync -aur staging/{project}/core drupal
cd drupal
sudo chown -R www-data:www-data core
cd ..
sudo rsync -aur staging/{project}/modules drupal
cd drupal
sudo chown -R www-data:www-data modules
cd ..
sudo rsync -aur staging/{project}/themes drupal
cd drupal
sudo chown -R www-data:www-data themes
cd ..
sudo rsync -aur staging/{project}/vendor drupal
cd drupal
sudo chown -R www-data:www-data vendor
cd ..
sudo rsync -auv staging/{project}/autoload.php drupal
sudo rsync -auv staging/{project}/composer.json drupal
sudo rsync -auv staging/{project}/composer.lock drupal
sudo rsync -auv staging/{project}/index.php drupal
sudo rsync -auv staging/{project}/robots.txt drupal
sudo rsync -auv staging/{project}/update.php drupal
sudo rsync -auv staging/{project}/web.config drupal
cd drupal
sudo chown www-data:www-data autoload.php
sudo chown www-data:www-data composer.json
sudo chown www-data:www-data composer.lock
sudo chown www-data:www-data index.php
sudo chown www-data:www-data robots.txt
sudo chown www-data:www-data update.php
sudo chown www-data:www-data web.config
cd ..
OR moving production to tmp as a source of back up
sudo rsync -aurv drupal/config tmp/{project}
sudo rsync -aurv drupal/core tmp/{project}
sudo rsync -aurv drupal/libraries tmp/{project}
sudo rsync -aurv drupal/modules tmp/{project}
sudo rsync -aurv drupal/themes tmp/{project}
sudo rsync -aurv drupal/vendor tmp/{project}
sudo rsync -aurv drupal/sites tmp/{project}
sudo rsync -auv drupal/autoload.php tmp/{project}
sudo rsync -auv drupal/composer.json tmp/{project}
sudo rsync -auv drupal/composer.lock tmp/{project}
sudo rsync -auv drupal/index.php tmp/{project}
sudo rsync -auv drupal/robots.txt tmp/{project}
sudo rsync -auv drupal/update.php tmp/{project}
sudo rsync -auv drupal/web.config tmp/{project}
cd tmp/{project}
sudo chown -R www-data:www-data config
sudo chown -R www-data:www-data core
sudo chown -R www-data:www-data libraries
sudo chown -R www-data:www-data modules
sudo chown -R www-data:www-data sites
sudo chown -R www-data:www-data themes
sudo chown -R www-data:www-data vendor
sudo chown www-data:www-data autoload.php
sudo chown www-data:www-data composer.json
sudo chown www-data:www-data composer.lock
sudo chown www-data:www-data index.php
sudo chown www-data:www-data robots.txt
sudo chown www-data:www-data update.php
sudo chown www-data:www-data web.config
cd ../..
Related articles
Andrew Fletcher
•
16 Jan 2025
get IP address from terminal OSX
When troubleshooting network issues or configuring devices, knowing your IP address can be essential. Whether you're connected via Wi-Fi, Ethernet, or tethering through a mobile provider, macOS offers powerful built-in tools to quickly identify your IP address. Here's a practical guide tailored to...
Andrew Fletcher
•
07 Jan 2025
Managing DDEV environment troubleshooting and setting up multiple Drupal projects
DDEV has become a popular tool for local web development, offering a streamlined approach to managing Docker-based environments. However, setting up and managing DDEV projects, particularly with the latest versions of Docker Desktop, can present challenges. This article guides you through resolving...
Andrew Fletcher
•
28 Dec 2024
Optimising file transfers by improving efficiency from cp to rsync
Transferring files between development and production environments is a critical task in the deployment process. However, I continue to come across multiple approaches that scale from awesome automation using pipelines to the basic of direct command line entry. Where the basic approaches rely on...