Skip to content

Instantly share code, notes, and snippets.

@amorev
Last active Jan 4, 2022
Embed
What would you like to do?
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