joshrandall8478 / joshrandall8478/backup
cleanup.sh needs to have a file limit
- Dominant language
- Shell
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Problem:
`cleanup.sh` is designed to remove old backups from the specified folder if these conditions are met:
- The archive is a `.tar.gz` file.
- The archive is in the specified format: `%Y-%m-%d-%H%M%S`
- The archive is older than the setback time specified in the command line args.
The one thing that we are not checking, is if there are enough backups saved in the directory before removing archives. This creates a potential situation where the script will blindly remove all backups that are older than the setback time, even if there are no newer ones present.
## Wanted solution:
Adding a hard limit of how many archives need to be present as a command line argument is the easiest and best way to solve this issue. This argument must be checked, and the script cannot run without this present.
> 💡 Tip: using `tail` may prove useful in this case, according to Google at least 
Resorting to creating an issue because I may not have enough time to work on this, and want to give others a fun shell script issue to work on.
Feel free to submit a pull request with as little or as much improvement as you want. 👍🏼
> ⚠️ **Please be warned:** This is not clean code. There are not many comments outlining processes. I will probably spend time commenting both scripts later. This will require you to read, know, and learn some shell script.
## For new git/GitHub users
Fork this repository then `git clone` it into your computer:
```sh
git clone https://github.com/yourusername/backup
```
Once you are ready to push changes, push the changes to your repository then make a pull request to this one.
[Click me if you are still lost](https://www.youtube.com/watch?v=mJ-qvsxPHpY).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.