Project

General

Profile

Helper Scripts » History » Version 15

Enis Nuredini, 23.08.2023 11:30

1 1 Enis Nuredini
h1. Helper Scripts
2
3 15 Enis Nuredini
Script destination: /scratch/share/system/helper-scripts
4
5 5 Enis Nuredini
h2. Backup project folder and both DBs
6
7
*tear_down_project.py*  
8 1 Enis Nuredini
Functionality: Creating backup file from project folder and databases (data and typo3). Transfering files to /scratch/tmp/365/. Comprimising all files in one tar. Deleting all created files during this process (except the summary tar file).
9 2 Enis Nuredini
10 1 Enis Nuredini
Requirement: User should have ssh keys for the affected server hosts.
11
12
Configuration: In the top of the script the project and database host can be written. Path to the ssh keys is set as default.
13
14 11 Enis Nuredini
Executed from: Own host
15 7 Enis Nuredini
16 5 Enis Nuredini
h2. Transfer specific records from DB1 to DB2
17
18 6 Enis Nuredini
*table_groupmember_reference_transfer.py* 
19 3 Enis Nuredini
Functionality: User given argument will be searched in configured column (default: reference) from table (default: GroupMember). All found records are transfered from source DB to target DB. If record with given argument exists on target DB then UPDATE statement is executed, otherwise INSERT statement.
20
21 14 Enis Nuredini
Requirement: User should have ssh keys for the affected server hosts. Table structure from source and target DB must be identical. Date and datetime defaults, if nothing given in source record needs to be NULL, otherwise mysql outputs an error.
22 3 Enis Nuredini
23
Configuration: DB-users, hostnames and affected table or column can be set inside the script.
24 7 Enis Nuredini
25 12 Enis Nuredini
Executed from: Own host
26
27 8 Enis Nuredini
h2. Guide to synchronize fileadmin files and transfer tables
28 7 Enis Nuredini
29
*set_project_live.py - table_data_transfer.py*
30 10 Enis Nuredini
Functionality: Numbered listing of all existing files and folders in fileadmin (depth level: 1). Ability to choose the paths which the user wants to synchronize with rsync. rsync with dry-run will be executed. Paths are filtered by existing files or folders that needs to be synced. Final rsync without dry-run will start and for every rsync user is asked if it should be executed. After fileadmin sync is finished the next script for table transfer will start automatically.  User is asked to give a comma seperated list of tables which should be transfered (overwrite) the tables on the target host.  DB dump from source and target host will be created. Affected target host tables will be truncated and overwritten with the source host table data.
31 7 Enis Nuredini
32
Requirement: Both scripts needs to be in same folder and located in source server host, where the to transfered project is. Used DB-Users should have access to the databases. Source host should have ssh access to target host.
33
34
Configuration: Target_hostname (default: w22a), DB-users and DB-hosts (wdb16.math.uzh.ch, wdb22.math.uzh.ch) can be defined inside the script. In this example the source host was: w16
35 13 Enis Nuredini
36
Executed from: Source host where the project is located.