Skip to content

Instantly share code, notes, and snippets.

@amorev
Last active December 30, 2024 10:48
Show Gist options
  • Save amorev/894e0e5e6a4ce604164eebae1b6e57aa to your computer and use it in GitHub Desktop.
Save amorev/894e0e5e6a4ce604164eebae1b6e57aa to your computer and use it in GitHub Desktop.
Telegram backup script
# создаем один tar.bz2 архив
backupDirectory=<backups_directory>
projectDirectory=<projects_directory>
chatId=<telegram_chat_id>
botToken=<telegram_bot_token>
cd $backupDirectory
tar -cvjf $backupDirectory/archive.full.tar.bz2 $projectDirectory
split -b 40M archive.full.tar.bz2 "archiver.tar.bz.part"
for i in `ls $backupDirectory | grep part`
do
curl -F chat_id=$chatId -F document=@$backupDirectory/$i https://api.telegram.org/bot$botToken/sendDocument
done
echo "finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment