Execute after completion

Sometimes you want to execute another command after the main command executes, this is often the case when you want to check the status of the main command, or if you want to send a notification.

  - title: Check date and send notification via apprise
    icon: date
    shell: date
    shellAfterCompleted: "apprise -c /config/apprise.yml -t 'Notification: Backup script completed' -b 'The backup script completed with code {{ exitCode}}. The log is: \n {{ stdout }} '"

When running shellAfterCompleted, you cannot use argument values - they are not passed to the command. However two special arguments are defined as shown above - exitCode and stdout from the previous shell command.

You can only use a single shellAfterCompleted, so use it for notifications, or similar. It would be an antipattern to use this do run 2 commands making up a mini script.

The official OliveTin container images from version 2024.03.24 onwards include the fantastic apprise tool, which makes chat notifications on many protocols very easy.

  - tgram://bottoken/ChatID