backing_up_your_data
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
backing_up_your_data [2021/11/17 09:54] – [Crontab on Linux] atolstov | backing_up_your_data [2022/08/12 14:23] – atolstov | ||
---|---|---|---|
Line 3: | Line 3: | ||
- | {{ :: | + | {{ network: |
<WRAP center round important 80%> | <WRAP center round important 80%> | ||
Line 24: | Line 24: | ||
<code bash backup.sh> | <code bash backup.sh> | ||
#!/bin/bash | #!/bin/bash | ||
- | # Create a folder ~/WEBHMI/ | + | # Create a folder ~/webhmi-log-cron, with the /tmp sub-folder. |
- | LOG_DIR=" | + | LOG_DIR=" |
+ | cd $LOG_DIR/ | ||
# download the yesterday' | # download the yesterday' | ||
yesterday=$(date +" | yesterday=$(date +" | ||
+ | |||
+ | |||
- | cd $LOG_DIR | ||
# because login and pass for the ftp connection are unencrypted you can | # because login and pass for the ftp connection are unencrypted you can | ||
# restrict read/write access mode to the file with chmod command) | # restrict read/write access mode to the file with chmod command) | ||
- | wget --user=admin --password=' | + | wget --user=admin --password=' |
#archive to save storage space | #archive to save storage space | ||
- | gzip -v log-$yesterday.sqlite3 | + | gzip -f -v log-$yesterday.sqlite3 |
+ | # Copy out of tmp .gz file and do not overwrite if destination filename already exists | ||
+ | cp -r --backup=t log-$yesterday.sqlite3.gz ../. | ||
+ | # Clear tmp folder | ||
+ | rm $LOG_DIR/ | ||
</ | </ | ||
backing_up_your_data.txt · Last modified: 2023/05/02 10:43 by atolstov