File tree Expand file tree Collapse file tree 2 files changed +77
-0
lines changed
Expand file tree Collapse file tree 2 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh -e
2+
3+ DAYOFWEEK=$( date +%u)
4+
5+ # Skip on weekends
6+ if [ " $DAYOFWEEK " -eq 6 ] || [ " $DAYOFWEEK " -eq 7 ]; then
7+ exit
8+ fi
9+
10+ # Exit early if any session with my_username is found
11+ if who | grep -wq ' my_username' ; then
12+ exit
13+ fi
14+
15+ # Phone numbers
16+ MY_NUMBER=' +xxx'
17+ NUMBER_OF_BOSS=' +xxx'
18+
19+ EXCUSES=(
20+ ' Locked out'
21+ ' Pipes broke'
22+ ' Food poisoning'
23+ ' Not feeling well'
24+ )
25+ rand=$[ $RANDOM % ${# EXCUSES[@]} ]
26+
27+ RANDOM_EXCUSE=${EXCUSES[$rand]}
28+ MESSAGE=" Gonna work from home. " $RANDOM_EXCUSE
29+
30+ # Send a text message
31+ RESPONSE=` curl -fSs -u " $TWILIO_ACCOUNT_SID :$TWILIO_AUTH_TOKEN " \
32+ -d " From=$MY_NUMBER " -d " To=$NUMBER_OF_BOSS " -d " Body=$MESSAGE " \
33+ " https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID /SMS/Messages" `
34+
35+ # Log errors
36+ if [ $? -gt 0 ]; then
37+ echo " Failed to send SMS: $RESPONSE "
38+ exit 1
39+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/sh -e
2+
3+ DAYOFWEEK=$( date +%u)
4+
5+ # Skip on weekends
6+ if [ " $DAYOFWEEK " -eq 6 ] || [ " $DAYOFWEEK " -eq 7 ]; then
7+ exit
8+ fi
9+
10+ # Exit early if no sessions with my_username are found
11+ if ! who | grep -wq ' my_username' ; then
12+ exit
13+ fi
14+
15+ # Phone numbers
16+ MY_NUMBER=' +xxx'
17+ HER_NUMBER=' +xxx'
18+
19+ REASONS=(
20+ ' Working hard'
21+ ' Gotta ship this feature'
22+ ' Someone fucked the system again'
23+ )
24+ rand=$[ $RANDOM % ${# REASONS[@]} ]
25+
26+ RANDOM_REASON=${REASONS[$rand]}
27+ MESSAGE=" Late at work. " $RANDOM_REASON
28+
29+ # Send a text message
30+ RESPONSE=` curl -fSs -u " $TWILIO_ACCOUNT_SID :$TWILIO_AUTH_TOKEN " \
31+ -d " From=$MY_NUMBER " -d " To=$HER_NUMBER " -d " Body=$MESSAGE " \
32+ " https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID /SMS/Messages" `
33+
34+ # Log errors
35+ if [ $? -gt 0 ]; then
36+ echo " Failed to send SMS: $RESPONSE "
37+ exit 1
38+ fi
You can’t perform that action at this time.
0 commit comments