You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-12Lines changed: 32 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
2
2
3
+
3
4
# Automated Server Backups!
4
5
5
6
### The Mission
@@ -110,13 +111,11 @@ tar czvfP $dest/$archive_file $backup_files
110
111
```
111
112
Confused by `czvfP`?
112
113
113
-
| option | description |
114
-
|--|--|
115
-
|`-c, --create`| create a new archive |
116
-
|`-z, --gzip`| filter the archive through gzip |
117
-
|`-v, --verbose`| verbosely list files processed |
118
-
|`-f, --file=ARCHIVE`| use archive file or device ARCHIVE |
119
-
|`-p, --preserve-permissions`| extract information about file permissions |
114
+
- `-c` create a new archive
115
+
- `-z` filter the archive through gzip
116
+
- `-v` verbosely list files processed
117
+
- `-f` use archive file or device ARCHIVE
118
+
- `-p` extract information about file permissions
120
119
121
120
Type `$ man tar` or visit the [docs](https://www.systutorials.com/docs/linux/man/1-tar/) for more information.
122
121
@@ -240,14 +239,27 @@ Unpack the downloaded file
240
239
$ tar -xvzf host-mysql-18-03-25.tar
241
240
```
242
241
243
-
## Thoughts:
244
-
Currently we are generating the file names for our server backup with the current date. This could be a problem if you are running the script more than once a day. Currently the file will be overwritten.
242
+
## Enhancements
245
243
246
-
Currently there is nothing which handles old server backups. If you run daily jobs you will hit the disk space limit soon.
244
+
### Delete old backup files
245
+
What to do with old back up files? You may don't need them anymore. If you run jobs on a daily basis you will hit the disk space limit soon. You could include a "old-file-deleter"in your script. Let's say we want to delete all files which are older than 14 days.
247
246
248
-
What would this script look like for a windows server backup?
247
+
```bash
248
+
# place at the end of backup.sh
249
+
find /mnt/backup -mtime +14 -type f -delete
250
+
```
251
+
- `/mnt/backup` to search in
252
+
- `-mtime +14` older than 14 days
253
+
- `-type f` only files
254
+
- `-delete` no surprise. **Remove it to test your `find` filter before executing the whole command**
249
255
250
-
How to include this script in CMS ?
256
+
## Thoughts:
257
+
258
+
- Currently we are generating the file names for our server backup with
259
+
the current date. This could be a problem if you are running the
260
+
script more than once a day. Currently the file will be overwritten.
261
+
- What would this script look like for a windows server backup?
262
+
- How to include this script in CMS ?
251
263
252
264
## Links:
253
265
@@ -256,4 +268,12 @@ How to include this script in CMS ?
0 commit comments