-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathstatus_notification
More file actions
executable file
·49 lines (39 loc) · 1.4 KB
/
status_notification
File metadata and controls
executable file
·49 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# Monitors changes in activity status and send notification when it changes
#
# Works on: Mac OS X
#
# Created by Mike Chambers
# https://www.mikechambers.com
#
# Released under an MIT License
# More info at:
# https://github.com/mikechambers/dcli/
#https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -u
#pull variables from environment variables. Otherwise, you can
#just manually set them below
#you can get your member id and platform from dclim
MEMBER_ID=$MEMBER_ID
PLATFORM=$PLATFORM
DEFAULT_CHECK_INTERVAL_SECONDS=15
echo "CTRL-C to end program"
OLD_ACTIVITY=""
while :
do
CHECK_INTERVAL_SECONDS=$DEFAULT_CHECK_INTERVAL_SECONDS
echo "Checking Status"
ACTIVITY=$(dclia --member-id "$MEMBER_ID" --platform "$PLATFORM")
#note should do some error checking here in case command fails (can capture exit code)
#we could have the command above output name / value pairs via --output-format tsv
#and then filter based on type of activity (i.e. crucible, strikes, etc...)
if [ "$OLD_ACTIVITY" != "$ACTIVITY" ]; then
echo "Status has changed"
echo "$ACTIVITY"
#note, you could get this running on linux using notify-send command
osascript -e "display notification \"${ACTIVITY}\" with title \"Destiny 2 Activity Changed\""
OLD_ACTIVITY=$ACTIVITY
CHECK_INTERVAL_SECONDS=60
fi
sleep $CHECK_INTERVAL_SECONDS
done