Add README and include license in it.
This commit is contained in:
parent
820923fd34
commit
38551cf68d
51
README.md
Normal file
51
README.md
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# Backup if change
|
||||||
|
This script help you to backup a file when it is detected changed, this script will copy the file to `--target-dir` with datetime as suffix.
|
||||||
|
|
||||||
|
## How it work
|
||||||
|
|
||||||
|
Just re-calculate the file's hash every a few seconds, when different with last result, copy it.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./backup-if-change.sh
|
||||||
|
option(s) --file or --target-dir is unspecified.
|
||||||
|
./backup-if-change.sh usage:
|
||||||
|
--target-dir Directory to store the backup files
|
||||||
|
--file The file to monitor
|
||||||
|
--hash-tool Tools to calculate hash of file, default sha256sum
|
||||||
|
--internel Seconds between checking file, default 32s
|
||||||
|
|
||||||
|
$ /path/to/backup-if-change.sh --file user3.dat --target-dir backup_dir --internel
|
||||||
|
2022-12-22T16:54:39,238228917+08:00 -- the hash now: c70f38d56b157a956249e43ad944bc990266b57ec0332d0596c30c73c3c19b01 user3.dat
|
||||||
|
2022-12-22T16:54:39,239715425+08:00 -- backuping the file to user3.dat_2022-12-21T22:09:17+08:00
|
||||||
|
2022-12-22T17:06:39,249323113+08:00 -- the hash now: ff2ab6b64f46c1ca2d7002c3c0f0818707ad2a920b36dba6f009728fdd12f7a4 user3.dat
|
||||||
|
2022-12-22T17:06:39,251145398+08:00 -- backuping the file to user3.dat_2022-12-22T17:04:32+08:00
|
||||||
|
^C
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
```
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Leafee98
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
```
|
Loading…
Reference in a new issue