Skip to content

Instantly share code, notes, and snippets.

@amorev
Last active February 11, 2024 01:17
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
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