ubuntu 20 + MySQL on VDS.
Created MySQL database backup to db1.sql.zst archives, ... db10.sql.zst:
mysqldump -uroot user2_db 'table1' --opt --no-create-info --where= 'ID >
0 and ID <
= 20000000 | ZSTD >
/backup/db1.sql.zst.
...
mysqldump -uroot user2_db 'table1' --opt --no-create-info --where= 'id >
180000000 and ID <
= 200000000 | ZSTD >
/backup/db10.sql.zst.
BD recovery takes a long time. And the PUTTY terminal can at any time reconnect to the server due to the break of communication (home Internet). Therefore, recovery commands write to the Restore.sh script:
#! /bin /bash
ZSTD -D <
/backup/db1.sql.zst | mysql -uroot user2_db;
...
zstd -d <
/backup/db10..sql.zst | mysql -uroot user2_db;
Run it through Crontab -E, and go to sleep). By morning recovery ends.
You need to change the Restore.sh script so that any error messages and warnings from ZSTD and MYSQL are written to the /backup/restore.log file.
How can this be implemented?
Add immediately after "#! /BIN /BASH"? And other scripts will also start writing to this log until you reboot Ubuntu?
Ruport2021-07-30 13:29:59Yes, on a new line after #! /BIN /BASH, it will only act for the script, which will be made and the reboot will not affect it. Those. The output redirection will be only those commands that are spelled out in the script where this line will add. For the test, what would be clearer, create a script that will return an error, for example, LS /SDSDSDS /and output to Stdout Echo "stdout text", and launch it, see what appeared in the log.
PotroNik2021-07-30 13:46:42- Can't start mysql server
- MySQL 5.7.37 is consuming CPU and High memory ( 90-95% )
- linux : cron -the task is not triggered
- linux : No Sensors found in Ubuntu 20.04 on Windows
- linux : How to transfer completely all data from one server to another?
- linux : Why doesn't anything appear in the SSH terminal when connecting to a remote server?
- How do I run my edited c++ file in the Linux Ubuntu terminal in the fastest way (by the shortest command)?
- linux : The problem with Ubuntu Software
- SQL Server 2019 Express for Linux on Ubuntu 20.04 -Bug -CU 13 -c0000005 EXCEPTION_ACCESS_VIOLATION when specifying @wkt in Table
- linux : How to run command C: \>netsh int ipv4 set glob defaultcurhoplimit= 65 on Ubuntu
I hope correctly understood, add a second string in the script after an interpreter announcement: Exec >>/backup/restore.log 2>&1 -the output of all commands from stdout and stderr in the script will be redirected to write to the /backup/restore.log
PotroNik2021-07-30 12:44:22