Automatyczny backup danych na Google Drive

User avatar
makrz
Posts: 401
Joined: Tue Nov 27, 2018 1:43 pm
Location: Opole

Post

klew wrote: Mon Apr 04, 2022 12:39 pm Wyświetliło się, że jedyny plik jaki próbuje usunąć nazywa się "Failed" :)
Wygląda, jakby poprzednia komenda się niepowiodła i nie pobrały się żadne nazwy plików do usunięcia i stąd dlasza część nie działa.

Przed linią "while read" dodaj

Code: Select all

echo "old backups: $OLD_BACKUPS"
echo "obsolete backups: $OBSOLETE_BACKUPS"
i pokaż co wyrzuca na ekran
po dodaniu jest tak

Code: Select all

pi@supla:~$  ./backup.sh
mysqldump: [Warning] Using a password on the command line interface can be insecure.
Uploading supla-20220404144310.sql.gz
Uploaded 1JRmRuc5xnOHi8Qfw5Kaj3ySLb7I8nUMK at 2.5 MB/s, total 4.2 MB
Removed supla-20220404144310.sql.gz
old backups: 2022-04-02T12:43:25Z
obsolete backups: Failed
Deleting Failed
Failed to get file: googleapi: Error 404: File not found: Failed., notFound
pi@supla:~$
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Wykonaj polecenie

Code: Select all

gdrive list -m 1000 --query "(('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) and trashed=false and modifiedTime < '2022-04-02T12:43:25Z'"  --order  "modifiedTime asc" --no-header | cut -d ' ' -f1
SUPLA.... Nareszcie w domu.
User avatar
makrz
Posts: 401
Joined: Tue Nov 27, 2018 1:43 pm
Location: Opole

Post

pzygmunt wrote: Mon Apr 04, 2022 1:56 pm Wykonaj polecenie

Code: Select all

gdrive list -m 1000 --query "(('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) and trashed=false and modifiedTime < '2022-04-02T12:43:25Z'"  --order  "modifiedTime asc" --no-header | cut -d ' ' -f1

Code: Select all

pi@supla:/usr/bin$ cd
pi@supla:~$ gdrive list -m 1000 --query "(('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) and trashed=false and modifiedTime < '2022-04-02T12:43:25Z'"  --order  "modifiedTime asc" --no-header | cut -d ' ' -f1
Failed
pi@supla:~$
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

To jeszcze

Code: Select all

gdrive list -m 1000 --query "(('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) and trashed=false and modifiedTime < '2022-04-02T12:43:25Z'"  --order  "modifiedTime asc" --no-header 
SUPLA.... Nareszcie w domu.
User avatar
makrz
Posts: 401
Joined: Tue Nov 27, 2018 1:43 pm
Location: Opole

Post

pzygmunt wrote: Mon Apr 04, 2022 2:49 pm To jeszcze

Code: Select all

gdrive list -m 1000 --query "(('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) and trashed=false and modifiedTime < '2022-04-02T12:43:25Z'"  --order  "modifiedTime asc" --no-header 
teraz tak

Code: Select all

pi@supla:~$ gdrive list -m 1000 --query "(('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) and trashed=false and modifiedTime < '2022-04-02T12:43:25Z'"  --order  "modifiedTime asc" --no-header
Failed to list files: googleapi: Error 400: Invalid Value, invalid
pi@supla:~$
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

spróbuj pominąć czas w testach z linii poleceń
SUPLA.... Nareszcie w domu.
User avatar
makrz
Posts: 401
Joined: Tue Nov 27, 2018 1:43 pm
Location: Opole

Post

pzygmunt wrote: Mon Apr 04, 2022 3:23 pm spróbuj pominąć czas w testach z linii poleceń
nie wiem czy o to chodziło

Code: Select all

pi@supla:~$ gdrive list -m 1000 --query "(('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) and trashed=false and modifiedTime"  --order  "modifiedTime asc" --no-header
Failed to list files: googleapi: Error 400: Invalid Value, invalid
pi@supla:~$
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Code: Select all

gdrive list -m 1000 --query "('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) "
SUPLA.... Nareszcie w domu.
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

W oryginalnym przykładzie wydaje się, że zjadłeś nawias.

Code: Select all

OBSOLETE_BACKUPS=$(gdrive list -m 1000 --query \
"(('${GDRIVE_DIR}' in parents) and trashed=false and modifiedTime < '$OLD_BACKUPS')" \
--order  "modifiedTime asc" --no-header | cut -d ' ' -f1)
SUPLA.... Nareszcie w domu.
User avatar
makrz
Posts: 401
Joined: Tue Nov 27, 2018 1:43 pm
Location: Opole

Post

pzygmunt wrote: Mon Apr 04, 2022 5:53 pm

Code: Select all

gdrive list -m 1000 --query "('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) "

Code: Select all

pi@supla:~$ gdrive list -m 1000 --query "('1jD89Scumo6YUzySl-xClNvTrwP9ZYUFj' in parents) "
Id                                  Name                          Type   Size     Created
1Go9IIEsQ4XfCJXz3OnOOoDYT7D384KKw   supla-20220404180001.sql.gz   bin    4.2 MB   2022-04-04 18:00:11
1Dhzw7U8gnWQCix9sq6IswDF1DETOm9sH   supla-20220404172217.sql.gz   bin    4.2 MB   2022-04-04 17:22:26
1_7wBIMZchu8lJzim-WPTJAzbcmf0xx8B   supla-20220404150824.sql.gz   bin    4.2 MB   2022-04-04 15:08:34
1BCaDsYY1wrqZxoXBtjB8wTbPCfo9PuqC   supla-20220404145903.sql.gz   bin    4.2 MB   2022-04-04 14:59:12
1iJNC3Ja-kQZO-ZPVgtzPAKKNpGbn9HTB   supla-20220404145345.sql.gz   bin    4.2 MB   2022-04-04 14:53:54
1JRmRuc5xnOHi8Qfw5Kaj3ySLb7I8nUMK   supla-20220404144310.sql.gz   bin    4.2 MB   2022-04-04 14:43:19
143QkGIxMQhQwjppPd8Jl-pbbi5SGtp85   supla-20220404140305.sql.gz   bin    4.2 MB   2022-04-04 14:03:14
13C9IRy6Vf6y_Figa2bvaKMsH9oSqEQIt   supla-20220404140102.sql.gz   bin    4.2 MB   2022-04-04 14:01:11
1CTm3qQYWR6egd5z7fK56pbkYr_m-gvUD   supla-20220404135722.sql.gz   bin    4.2 MB   2022-04-04 13:57:31
1lC3hRJhgx3anxo_g_glblEAu010fQ8zc   supla-20220404135421.sql.gz   bin    4.2 MB   2022-04-04 13:54:30
1FdpIdav9ynLB60PNO3GzYPFe41Kbh7cE   supla-20220404135036.sql.gz   bin    4.2 MB   2022-04-04 13:50:45
1vrlPOB4ffbyA8X3kh0X-GdF-0bEvnuGO   supla-20220404134558.sql.gz   bin    4.2 MB   2022-04-04 13:46:08
1Jpbsd1Aq2wpSkig7ZSYCPC1KFfuEWx2-   supla-20220404133904.sql.gz   bin    4.2 MB   2022-04-04 13:39:13
1pZ-h7dcgA0zt9K7LKmfl6wMLm_t5wxs_   supla-20220404132633.sql.gz   bin    4.2 MB   2022-04-04 13:26:42
1NNeq7Yo3jSp2O2P4WB08fxb0nTdexH0i   supla-20220404132432.sql.gz   bin    4.2 MB   2022-04-04 13:24:41
1ewiH_kvQ2arywtou7kLAkNPlRiC6vSes   supla-20220404130945.sql.gz   bin    4.2 MB   2022-04-04 13:09:54
19wTlHnyn29rlKYrpuRx46zJaaVbe16J5   supla-20220404130642.sql.gz   bin    4.2 MB   2022-04-04 13:06:51
1IbXXw3brcb7ihpVXWWh27doYQAuZ_uU0   supla-20220404130036.sql.gz   bin    4.2 MB   2022-04-04 13:00:46
1KO0yUfbPBYHVGqo04QKLwiOrMihyz6bN   supla-20220404125714.sql.gz   bin    4.2 MB   2022-04-04 12:57:23
1O7HKeXFHgTupAXuclSqDkwQsz8gr0Rd3   supla-20220404125407.sql.gz   bin    4.2 MB   2022-04-04 12:54:15
1nfh6st_v_ePGNiR4opnawOdIm8JsxaMn   supla-20220404125226.sql.gz   bin    4.2 MB   2022-04-04 12:52:35
1McvTlh_YN2x8Nlu6A7wBClKmzc__ZEpJ   supla-20220404123315.sql.gz   bin    4.2 MB   2022-04-04 12:33:24
10e1zV3ddyYyiVvmdt9twbgKU2EDnajMf   supla-20220404122852.sql.gz   bin    4.2 MB   2022-04-04 12:29:01
1gZmf5NhUtxOAZAmT7GHX6FNLS6Vs9fGp   supla-20220404120001.sql.gz   bin    4.2 MB   2022-04-04 12:00:11
12MX5l8OfZdiFB9RWFALnAJ_LCYj1hhlw   supla-20220404073419.sql.gz   bin    4.2 MB   2022-04-04 07:34:28
1smZyXhHbjswnP2jXIWpO7VLYxXUoBnwc   supla-20220404073241.sql.gz   bin    4.2 MB   2022-04-04 07:32:50
1VAVNLv3U95amUdvJ8yEOuIKebbEswiQ8   supla-20220404060001.sql.gz   bin    4.2 MB   2022-04-04 06:00:11
1HHV2FfGZcDyCWkATLOBANl4GEK6sWPH_   supla-20220404000001.sql.gz   bin    4.2 MB   2022-04-04 00:00:12
1ifs9nLlxekGslFyeIve8vbCgTS54Py9j   supla-20220403194149.sql.gz   bin    4.2 MB   2022-04-03 19:41:59
1LRwd22Eg7za6JP4sMUJz-KOxQW-g1wIW   supla-20220403192426.sql.gz   bin    4.2 MB   2022-04-03 19:24:35
1WzjfvueTNGUrg3lbLJaT3sxBWcVEDz-w   supla-20220403192227.sql.gz   bin    4.2 MB   2022-04-03 19:22:37
1VOdCeI2DZu0_RfyA-RNDO1UKJntUDAeo   supla-20220403180001.sql.gz   bin    4.2 MB   2022-04-03 18:00:11
1vBJp_UEm9byeCh63BMeD-lXF-J0yTkvo   supla-20220403120001.sql.gz   bin    4.2 MB   2022-04-03 12:00:11
1H8U4KwiF9idKT3PaKqvH8IzTwQ9R9zmO   supla-20220403060001.sql.gz   bin    4.2 MB   2022-04-03 06:00:11
1fz_HYyPCz6b1Ep-xJh8u26FTyLhPHdGB   supla-20220403000001.sql.gz   bin    4.2 MB   2022-04-03 00:00:11
1SKJO4VPZIAaaFtnXpsFr7WnE15rVmCXR   supla-20220402180001.sql.gz   bin    4.2 MB   2022-04-02 18:00:11
1BV8I-R2dpse26R8mYZpd9S2-supeEuhq   supla-20220402120001.sql.gz   bin    4.2 MB   2022-04-02 12:00:11
10vZt-uZAyl1f5MZIiXTGVmYZvblnBfb8   supla-20220402060001.sql.gz   bin    4.2 MB   2022-04-02 06:00:11
1qhHxjS6ojz59FXRXSqZWJRvbcgpcB2kF   supla-20220402000001.sql.gz   bin    4.2 MB   2022-04-02 00:00:11
1rj7lt624BuXO_0cppI6SFMuhLBd24Wvo   supla-20220401180001.sql.gz   bin    4.2 MB   2022-04-01 18:00:12
1prpG1dWI8sdSLQg66LvKP8H9sWsTQmB7   supla-20220401120002.sql.gz   bin    4.2 MB   2022-04-01 12:00:11
1azfZg4ahso-ueHwB_BL9wrFQijBbt5YD   supla-20220401060001.sql.gz   bin    4.2 MB   2022-04-01 06:00:12
15Y4ctGUmTOx-TKUOPlihqZ3zV8kjBE9G   supla-20220401000001.sql.gz   bin    4.2 MB   2022-04-01 00:00:12
1wTN5zS9IBDPgShtY1Fp1RMvZ39hiyTTF   supla-20220331180001.sql.gz   bin    4.2 MB   2022-03-31 18:00:11
1ANV4i6nsYfm-EeJoRcg6eYpfCSnMSauQ   supla-20220331120001.sql.gz   bin    4.1 MB   2022-03-31 12:00:11
1NPbFP6YpvAFVAG1QNGEgfq1RYpGSZW0R   supla-20220331115106.sql.gz   bin    4.1 MB   2022-03-31 11:51:15
1MQgiMW1gQXhxZjTW6t2_MtEvyKwTclYH   supla-20220330200001.sql.gz   bin    4.1 MB   2022-03-30 20:00:10
pi@supla:~$

Return to “Pomoc”