I am using a bash script to run a for loop to Rclone my backups to Backblaze.
I am able to muddle my way through making a for loop so it processes each backup folder one at a time.
I have been trying to expand on this slightly to send a slack notification when each one is finished.
the notification works ok but I can't find out how to include the current name in the JSON that gets sent.
My code is as follows
Code:
#!/bin/bash
# A Simple Rclone Loop
names='user1 user2 user3 user4'
for name in $names
do
rclone sync /home/$name/backup backblaze:my-bucket/$name -v --bwlimit 9M --log-file=/path/to/rcloneupload.log
curl -X POST -H 'Content-type: application/json' --data '{"text":"Backup Finished"}' https://hooks.slack.com/services/xxxxxxx-myslackwebhook-xxxxxxxxx
done
Its how to get the current $name into the JSON that gets sent to slack.
What i want is essentially
Code:
'{"text":"$name Backup Finished"}'
that doesn't get parsed.
I have tried to concatenate things and it says its invalid JSON.
Sorry for the noob trying to do complex things post. Any help would be appreciated.
Extra imaginary internet points if I can get the size of the files transferred from Rclone into the slack message