Compare commits
36 Commits
folderarch
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f01708712a | |||
| cb29181e76 | |||
| 37e0986745 | |||
| 6e11715467 | |||
| 67c7a66b51 | |||
| 356689bb76 | |||
| cc0b03e7ff | |||
| 264fc248ba | |||
| 3e44f9f2e6 | |||
| fd1fcd3530 | |||
| 50eef7658f | |||
| 676292be85 | |||
| 7e19fe7d19 | |||
| 49139fb445 | |||
| c109be46f7 | |||
| a426f1af49 | |||
| 8744a50562 | |||
| 3f3c743262 | |||
| 273994e82a | |||
| 400dd25e7d | |||
| df55cbd534 | |||
| 55ca28e9cb | |||
| b39abe8cc0 | |||
| d7b73ed6e9 | |||
| 024690be38 | |||
| 8cac2026ce | |||
| 8976ba7deb | |||
| 36761eefba | |||
| ca0ba76fae | |||
| 7ec219bb67 | |||
| 58f9712e53 | |||
| 568b7ac2f1 | |||
| 5b33466451 | |||
| 582e3f5248 | |||
| e372037040 | |||
| 823d0a6969 |
44
README.md
44
README.md
@@ -1,5 +1,10 @@
|
|||||||
# Folder archive
|
# Folder2Archive
|
||||||
> Daily Folder Backup and Rotation for Linux
|
<img align="right" width="150" src="https://git.moelle.space/hxcde/folder2archive/raw/branch/main/f2a.png">
|
||||||
|
<br>
|
||||||
|
|
||||||
|
> Daily Folder Backup and Rotation for Linux <br>
|
||||||
|
> I use this to create archives of my website every day
|
||||||
|
|
||||||
|
|
||||||
## Key Features:
|
## Key Features:
|
||||||
- Daily automated backups of a specified folder using the zip utility.
|
- Daily automated backups of a specified folder using the zip utility.
|
||||||
@@ -18,14 +23,41 @@
|
|||||||
|
|
||||||
Paste the script in your machines console.
|
Paste the script in your machines console.
|
||||||
```bash
|
```bash
|
||||||
sh -c "$(curl -L http://script.moelle.space/folderarchive)"
|
sh -c "$(curl -L http://script.moelle.space/folder2archive)"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Change the day count </summary>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
Edit the file zip_folder_daily.sh `(If you used automatic install it's in /opt)` and change the day number in line 16.
|
||||||
|
<br> If you want 30 days, it's `30 minus 1`, so `29`
|
||||||
|
```bash
|
||||||
|
find "${ARCHIVE_DIR}" -name "folder_*.zip" -mtime +13 -exec rm {} \;
|
||||||
|
```
|
||||||
|
Example: Chamge the `13` to `29`
|
||||||
|
```bash
|
||||||
|
find "${ARCHIVE_DIR}" -name "folder_*.zip" -mtime +29 -exec rm {} \;
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Change the schedule </summary>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
Edit the cronjob with `crontab -e`
|
||||||
|
```bash
|
||||||
|
0 13 * * * sh /path/to/script/zip_folder_daily.sh
|
||||||
|
```
|
||||||
|
If you need help to configure the crontab, check this site https://crontab.guru/
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Manual installation
|
## Manual installation
|
||||||
<details>
|
<details>
|
||||||
<summary>expand </summary>
|
<summary>Installation </summary>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
Install git and zip
|
Install git and zip
|
||||||
@@ -34,8 +66,10 @@ apt install git zip -y
|
|||||||
```
|
```
|
||||||
Clone the repository
|
Clone the repository
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.moelle.space/hxcde/folderarchive.git
|
git clone https://git.moelle.space/hxcde/folder2archive.git
|
||||||
```
|
```
|
||||||
|
Edit the zip_folder_daily.sh file
|
||||||
|
<br>
|
||||||
Add the following to cron to automate Backup
|
Add the following to cron to automate Backup
|
||||||
```bash
|
```bash
|
||||||
0 13 * * * sh /path/to/script/zip_folder_daily.sh
|
0 13 * * * sh /path/to/script/zip_folder_daily.sh
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo checking if Zip is installed
|
echo checking if Zip is installed
|
||||||
apt-get install zip -y
|
apt-get install zip -y
|
||||||
yum install zip -y
|
#yum install zip -y
|
||||||
apk add zip
|
#apk add zip
|
||||||
cd /opt/
|
cd /opt/
|
||||||
echo "#!/bin/bash" > zip_folder_daily.sh
|
echo "#!/bin/bash" > zip_folder_daily.sh
|
||||||
echo "#Enter the directory to be zipped (e.g., /path/to/folder)" >> zip_folder_daily.sh
|
echo "#Enter the directory to be zipped (e.g., /path/to/folder)" >> zip_folder_daily.sh
|
||||||
@@ -13,10 +13,10 @@ echo "# Enter the directory where the zipped files will be stored (e.g., /path/t
|
|||||||
echo "Enter the directory where the zipped files will be stored (e.g., /path/to/archive)"
|
echo "Enter the directory where the zipped files will be stored (e.g., /path/to/archive)"
|
||||||
read archive
|
read archive
|
||||||
echo "ARCHIVE_DIR='"$archive"'" >> zip_folder_daily.sh
|
echo "ARCHIVE_DIR='"$archive"'" >> zip_folder_daily.sh
|
||||||
curl https://git.moelle.space/hxcde/folderarchive/raw/branch/main/append >> zip_folder_daily.sh
|
curl https://git.moelle.space/hxcde/folder2archive/raw/branch/main/append >> zip_folder_daily.sh
|
||||||
sh /opt/zip_folder_daily.sh
|
sh /opt/zip_folder_daily.sh
|
||||||
|
|
||||||
crontab -l > mycron
|
crontab -l > mycron
|
||||||
echo "0 13 * * * sh /opt/folderarchive/zip_folder_daily.sh" >> mycron
|
echo "0 13 * * * sh /opt/zip_folder_daily.sh" >> mycron
|
||||||
crontab mycron
|
crontab mycron
|
||||||
rm mycron
|
rm mycron
|
||||||
Reference in New Issue
Block a user