28 Commits

Author SHA1 Message Date
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
bc243875a6 - 2023-04-14 22:22:31 +02:00
a293eb866b „README.md“ ändern 2023-04-12 14:28:25 +00:00
cd65328f1b „README.md“ ändern 2023-04-12 09:43:51 +00:00
ea3d2b30f1 „README.md“ ändern 2023-04-12 08:16:00 +00:00
3 changed files with 49 additions and 4 deletions

View File

@ -14,15 +14,30 @@
- The find command is used to delete files older than 14 days in the archive directory. (edit in the script as needed) - 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). - 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/folderarchive)"
```
## Manual installation
<details>
<summary>expand </summary>
<br>
Install git and zip Install git and zip
```bash ```bash
apt install git zip -y apt install git zip -y
``` ```
Clone the repository Clone the repository
```bash ```bash
git clone https://github.com/hxcde/folderarchive.git git clone https://git.moelle.space/hxcde/folderarchive.git
``` ```
Add the following to cron: Add the following to cron to automate Backup
```bash ```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 {} \;

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/folderarchive/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