Direkt zum Inhalt
Startseite

Main navigation

  • Startseite
  • Neue Frage stellen!
User account menu
  • Anmelden

Pfadnavigation

  1. Startseite

Drupal Backup & Update Shell Script (Multiple Users / Sites on Linux)

By Gast (nicht überprüft), 20 Juli, 2023

drush.ini

safe_mode =
open_basedir =
max_execution_time = 3600
max_file_uploads = 20
max_input_time = 3600
memory_limit = 8G

 

drupal_backup_update.sh

#!/bin/bash
array=( myuser1 otheruser2 user3 user4 )
for i in "${array[@]}"
do
drush='php -c ~/httpdocs/drush.ini ~/httpdocs/vendor/drush/drush/drush'

if [[ $1 == status ]]; then
su  "$i" <<EOF
cd && cd httpdocs
echo " --------------------- STATUS -------------------"
${drush} status
${drush} pm:security
composer update --dry-run
EOF
fi





if [[ $1 == backup ]]; then
 su  "$i" <<EOF
cd && cd httpdocs
echo " --------------------- BACKUP -------------------"
${drush} sql:dump  | gzip -c > ../backup/db-$(date +%Y-%m-%d-%H%M).sql.gz && tar -zcf ../backup/web-$(date +%Y-%m-%d-%H%M).tar.gz ../httpdocs/
ls -lah ../backup | grep $(date +%Y-%m-%d)
EOF
fi






if [[ $2 == update ]]; then

su  "$i" <<EOF
cd && cd httpdocs
echo " --------------------- UPDATE -------------------"
composer update
${drush} updb -y
${drush} webform:libraries:download
${drush} cr
EOF

fi

run:

/path/to/drupal_backup_update.sh backup update
  • Linux

Comments

Hilfe zum Textformat
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Neueste Kommentare

  • Fragen zu Drupal 10 Cache

    3 Tage 13 Stunden ago
    4 Wege um Drupal Cache zu löschen / leeren?
    Read more
  • Solution:
    sudo chmod 777 -R…

    1 Woche 5 Tage ago
    User warning: mkdir(): Permission Denied in FileStorage->createDirectory() (Line 123 in web/core/lib/Drupal/Component/PhpStorage/FileStorage.php).
    Read more
  • Alternativ mit SFTP : 
    sftp…

    1 Woche 5 Tage ago
    Server-to-Server Transfer - Download vie SCP / SSH / SFTP
    Read more
  • Plesk

    4 Wochen 1 Tag ago
    PHPStan failed - PHP Fatal error: Trait "Symfony\Bridge\PhpUnit\Legacy\PolyfillAssertTrait" not found in
    Read more
  • Das hilft: symfony/phpunit-bridge + chmod 777

    4 Wochen 2 Tage ago
    PHPStan failed - PHP Fatal error: Trait "Symfony\Bridge\PhpUnit\Legacy\PolyfillAssertTrait" not found in
    Read more
  • Solution ( ~/bash_profile ):…

    1 Monat ago
    Drush Error / PHP Warning: Phar::mapPhar(): open_basedir restriction in effect.
    Read more
  •  
     
    Backup Web & DB:
    drush…

    4 Wochen 1 Tag ago
    Drush 10 - sql:dump & compress backup to .gz file
    Read more
  • Das funktioniert:
    /usr/local…

    3 Monate ago
    phpenv: composer: command not found
    Read more
  • Die Lösung ist:

    # export…

    8 Monate ago
    Composer plugins have been disabled for safety in this non-interactive session. Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.
    Read more
  • IT ist Grundlage der EDV

    7 Monate ago
    Gibts Unterschied zwischen EDV und IT?
    Read more

Tools

  • Cookie settings
  • Inhalt hinzufügen
  • Neuester Inhalt

Fußbereich

  • Allgemeine Geschäftsbedingungen - Datenschutz - Impressum