From 42c50a8aa421f6e5211166b48101708726ff28e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20M=C3=B6lle?= Date: Tue, 18 Apr 2023 19:46:56 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9Einstall.sh=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 73c502b..1bedf1e 100644 --- a/install.sh +++ b/install.sh @@ -1,9 +1,19 @@ #!/bin/bash cd /opt/ -git clone https://git.moelle.space/hxcde/folderarchive.git -chmod +x /folderarchive/zip_folder_daily.sh -crontab -l > mycron -echo "0 13 * * * sh /opt/folderarchive/zip_folder_daily.sh" >> mycron -crontab mycron -rm mycron \ No newline at end of file +echo "#!/bin/bash" > zip_folder_daily.sh +echo "# Enter the directory to be zipped (e.g., /path/to/folder)" >> zip_folder_daily.sh +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 +read archive +echo "ARCHIVE_DIR=" '$archive' "" >> zip_folder_daily.sh +echo "DATE=$(date +%Y-%m-%d)" >> zip_folder_daily.sh +echo "zip -r "${ARCHIVE_DIR}/folder_${DATE}.zip" "${SOURCE_DIR}"" >> zip_folder_daily.sh +echo "find "${ARCHIVE_DIR}" -name "folder_*.zip" -mtime +13 -exec rm {} \;" >> zip_folder_daily.sh + + +#crontab -l > mycron +#echo "0 13 * * * sh /opt/folderarchive/zip_folder_daily.sh" >> mycron +#crontab mycron +#rm mycron \ No newline at end of file