You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/examples.md
+59
Original file line number
Diff line number
Diff line change
@@ -634,3 +634,62 @@ or by simply providing traccar with a valid username/password combination.
634
634
<entry key='sms.http.user'>phil</entry>
635
635
<entry key='sms.http.password'>mypass</entry>
636
636
```
637
+
638
+
## Terminal Notifications for Long-Running Commands
639
+
640
+
This example provides a simple way to send notifications using [ntfy.sh](https://ntfy.sh) when a terminal command completes. It includes success or failure indicators based on the command's exit status.
641
+
642
+
### Setup
643
+
644
+
1. Store your ntfy.sh bearer token securely if access control is enabled:
645
+
646
+
```sh
647
+
echo "your_bearer_token_here" > ~/.ntfy_token
648
+
chmod 600 ~/.ntfy_token
649
+
```
650
+
651
+
1. Add the following function and alias to your `.bashrc` or `.bash_profile`:
652
+
653
+
```sh
654
+
# Function for alert notifications using ntfy.sh
655
+
notify_via_ntfy() {
656
+
local exit_status=$? # Capture the exit status before doing anything else
657
+
local token=$(< ~/.ntfy_token) # Securely read the token
0 commit comments