A Mac sysadmin, documenting useful code, ideas, & guides.

Slack rsync

· Read in about 2 min · (220 Words)
python automation

With a little push from @groob, I have created a simple python script that runs a rsync command and sends a summary of the run to Slack. Slack was not created to be a storage vault for server logs however it does great for short sms style messages. If you are using a log collection service like logstash you could extend on this script to include the link to your uploaded log or if an error occurs you could automatically create a helpdesk ticket for you to investigate the issue.

My use case is simple, every day I sync my munki repo to a separate server (I also have backups don’t worry). I only need to know that the task completed successfully. I have little desire to see a verbose output of every single line of an rsync run. With the rsync --stats flag you can see a summary of the run which is then sent to Slack. The green bar will change to red if an error has occurred, which allows anyone to know if an error has occurred at a glance.

Sample output:

For this to work you will need to:

To see the project README and get the script visit: sync_slack