Compare commits

...

62 Commits

Author SHA1 Message Date
37e0986745 „README.md“ ändern 2023-04-18 21:07:31 +02:00
6e11715467 „README.md“ ändern 2023-04-18 20:58:45 +02:00
67c7a66b51 „README.md“ ändern 2023-04-18 20:58:34 +02:00
356689bb76 „README.md“ ändern 2023-04-18 20:58:27 +02:00
cc0b03e7ff „README.md“ ändern 2023-04-18 20:58:19 +02:00
264fc248ba „README.md“ ändern 2023-04-18 20:58:10 +02:00
3e44f9f2e6 „README.md“ ändern 2023-04-18 20:58:02 +02:00
fd1fcd3530 Dateien hochladen nach „“ 2023-04-18 20:57:02 +02:00
50eef7658f „README.md“ ändern 2023-04-18 20:41:49 +02:00
676292be85 „install.sh“ ändern 2023-04-18 20:39:59 +02:00
7e19fe7d19 „README.md“ ändern 2023-04-18 20:39:42 +02:00
49139fb445 „README.md“ ändern 2023-04-18 20:39:06 +02:00
c109be46f7 „README.md“ ändern 2023-04-18 20:33:41 +02:00
a426f1af49 „README.md“ ändern 2023-04-18 20:31:34 +02:00
8744a50562 „README.md“ ändern 2023-04-18 20:29:51 +02:00
3f3c743262 „README.md“ ändern 2023-04-18 20:29:10 +02:00
273994e82a „README.md“ ändern 2023-04-18 20:28:53 +02:00
400dd25e7d „README.md“ ändern 2023-04-18 20:27:14 +02:00
df55cbd534 „README.md“ ändern 2023-04-18 20:26:41 +02:00
55ca28e9cb „README.md“ ändern 2023-04-18 20:25:51 +02:00
b39abe8cc0 „README.md“ ändern 2023-04-18 20:20:11 +02:00
d7b73ed6e9 „README.md“ ändern 2023-04-18 20:19:26 +02:00
024690be38 „README.md“ ändern 2023-04-18 20:19:13 +02:00
8cac2026ce „README.md“ ändern 2023-04-18 20:18:47 +02:00
8976ba7deb „README.md“ ändern 2023-04-18 20:18:20 +02:00
36761eefba „README.md“ ändern 2023-04-18 20:17:19 +02:00
ca0ba76fae „README.md“ ändern 2023-04-18 20:16:38 +02:00
7ec219bb67 „README.md“ ändern 2023-04-18 20:16:17 +02:00
58f9712e53 „README.md“ ändern 2023-04-18 20:15:52 +02:00
568b7ac2f1 „README.md“ ändern 2023-04-18 20:14:55 +02:00
5b33466451 „README.md“ ändern 2023-04-18 20:14:19 +02:00
582e3f5248 „README.md“ ändern 2023-04-18 20:14:02 +02:00
e372037040 „README.md“ ändern 2023-04-18 20:13:26 +02:00
823d0a6969 „README.md“ ändern 2023-04-18 20:13:06 +02:00
b3b77ab7b5 „README.md“ ändern 2023-04-18 20:10:11 +02:00
728e9547ea „README.md“ ändern 2023-04-18 20:07:57 +02:00
146175988f „README.md“ ändern 2023-04-18 20:07:40 +02:00
e9fa3986b3 „README.md“ ändern 2023-04-18 20:06:24 +02:00
7a3dc4e949 „README.md“ ändern 2023-04-18 20:05:55 +02:00
041206fadf „README.md“ ändern 2023-04-18 20:05:35 +02:00
267096c511 „README.md“ ändern 2023-04-18 20:04:58 +02:00
cd4a7e0fb9 „README.md“ ändern 2023-04-18 20:04:47 +02:00
43b16e64af „README.md“ ändern 2023-04-18 20:03:41 +02:00
5db0b69a4c „README.md“ ändern 2023-04-18 20:02:32 +02:00
a56c9d5185 „install.sh“ ändern 2023-04-18 20:00:17 +02:00
d776db6ea7 „append“ hinzufügen 2023-04-18 19:59:13 +02:00
2a8b86fcd2 „install.sh“ ändern 2023-04-18 19:55:25 +02:00
e80976e0ee „install.sh“ ändern 2023-04-18 19:54:18 +02:00
99b6ee9525 „install.sh“ ändern 2023-04-18 19:53:16 +02:00
979dbb84f3 „install.sh“ ändern 2023-04-18 19:51:53 +02:00
2369ed3136 „install.sh“ ändern 2023-04-18 19:50:40 +02:00
82f7acf2cc „install.sh“ ändern 2023-04-18 19:49:46 +02:00
42c50a8aa4 „install.sh“ ändern 2023-04-18 19:46:56 +02:00
acb433890c „install.sh“ ändern 2023-04-18 15:32:41 +02:00
7890f96136 „install.sh“ ändern 2023-04-18 15:32:18 +02:00
9b0eea276a „install.sh“ ändern 2023-04-18 15:30:26 +02:00
9d76fa8516 „install.sh“ ändern 2023-04-18 15:29:50 +02:00
10bd042270 „install.sh“ hinzufügen 2023-04-18 15:29:38 +02:00
Yann Mölle
bc243875a6 - 2023-04-14 22:22:31 +02:00
a293eb866b „README.md“ ändern 2023-04-12 14:28:25 +00:00
Yann Mölle
cd65328f1b „README.md“ ändern 2023-04-12 09:43:51 +00:00
Yann Mölle
ea3d2b30f1 „README.md“ ändern 2023-04-12 08:16:00 +00:00
4 changed files with 85 additions and 6 deletions

View File

@ -1,5 +1,10 @@
# Folder archive
> Daily Folder Backup and Rotation for Linux
# Folder2Archive
<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:
- Daily automated backups of a specified folder using the zip utility.
@ -14,15 +19,59 @@
- The find command is used to delete files older than 14 days in the archive directory. (edit in the script as needed)
- The cron entry schedules the script to run daily at 13:00 (1 PM).
## Automatic installation
Paste the script in your machines console.
```bash
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
<details>
<summary>Installation </summary>
<br>
Install git and zip
```bash
apt install git zip -y
```
Clone the repository
```bash
git clone https://github.com/hxcde/folderarchive.git
git clone https://git.moelle.space/hxcde/folder2archive.git
```
Add the following to cron:
Edit the zip_folder_daily.sh file
<br>
Add the following to cron to automate Backup
```bash
0 13 * * * /path/to/script/zip_folder_daily.sh
0 13 * * * sh /path/to/script/zip_folder_daily.sh
```
</details>

8
append Normal file
View File

@ -0,0 +1,8 @@
# Create a timestamp in the format YYYY-MM-DD
DATE=$(date +%Y-%m-%d)
# Create the zipped archive and append the date
zip -r "${ARCHIVE_DIR}/folder_${DATE}.zip" "${SOURCE_DIR}"
# Delete files older than 14 days
find "${ARCHIVE_DIR}" -name "folder_*.zip" -mtime +13 -exec rm {} \;

BIN
f2a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

22
install.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
echo checking if Zip is installed
apt-get install zip -y
yum install zip -y
apk add zip
cd /opt/
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)"
read path
echo "SOURCE_DIR='"$path"'" >> zip_folder_daily.sh
echo "# Enter the directory where the zipped files will be stored (e.g., /path/to/archive)" >> zip_folder_daily.sh
echo "Enter the directory where the zipped files will be stored (e.g., /path/to/archive)"
read archive
echo "ARCHIVE_DIR='"$archive"'" >> 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
crontab -l > mycron
echo "0 13 * * * sh /opt/folderarchive/zip_folder_daily.sh" >> mycron
crontab mycron
rm mycron