creativeprojects / resticprofile

Configuration profiles manager and scheduler for restic backup
https://creativeprojects.github.io/resticprofile/
GNU General Public License v3.0
604 stars 29 forks source link

Add backup duration variable to send-after hook #371

Open MexHigh opened 3 weeks ago

MexHigh commented 3 weeks ago

It would be super useful to have a variable that holds the time of how long the backup took in the senf-after and send-after-fail hooks. Maybe something like this with ${BACKUP_DURATION}?:

base:
  backup:
    send-after:
      method: POST
      url: https://example.com/message
      body: "title=Profile ${PROFILE_NAME} ${PROFILE_COMMAND} success&message=Backup took: ${BACKUP_DURATION}"
      headers:
        - name: "Content-Type"
          value: "application/x-www-form-urlencoded"
    send-after-fail:
      method: POST
      url: https://example.com/message
      body: "title=Profile ${PROFILE_NAME} ${PROFILE_COMMAND} failed&message=${ERROR}\n\n${ERROR_STDERR}\n\nTook: ${BACKUP_DURATION}"
      headers:
        - name: "Content-Type"
          value: "application/x-www-form-urlencoded"
...