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
•
22 May 2024
Checking if a File Exists Using Command Line Queries in Ubuntu with Nginx
When managing a server or developing applications, particularly on an Ubuntu system running Nginx, it's often necessary to verify the existence of files. This is crucial for tasks like deploying new versions, checking configuration files, or ensuring that required assets are in place. In this...
Andrew Fletcher
•
20 May 2024
Create a copy of files that go to the tmp directory
To review the content of files being generated in the /tmp directory on an Ubuntu server before Microsoft Defender removes them, you can use several approaches. Following is the approach we took. Real-Time MonitoringYou can set up a script to monitor the /tmp directory and log the...
Andrew Fletcher
•
09 May 2024
Efficiently managing large file archives in Linux: excluding directories with Zip
Managing large directories, especially those filled with a diverse mix of media such as documents and images, can quickly become cumbersome. In my latest project, dealing with a directory that totals a whopping 87GB, the need for efficient file compression and selective archiving became apparent....