2015-11-22 01:55:54 +04:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2015-11-24 03:46:12 +04:00
|
|
|
# Exit early if any session with my username is found
|
2015-11-23 09:15:40 -06:00
|
|
|
if who | grep -wq $USER; then
|
2015-11-22 01:55:54 +04:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Phone numbers
|
|
|
|
MY_NUMBER='+xxx'
|
|
|
|
NUMBER_OF_BOSS='+xxx'
|
|
|
|
|
|
|
|
EXCUSES=(
|
|
|
|
'Locked out'
|
|
|
|
'Pipes broke'
|
|
|
|
'Food poisoning'
|
|
|
|
'Not feeling well'
|
|
|
|
)
|
|
|
|
rand=$[ $RANDOM % ${#EXCUSES[@]} ]
|
|
|
|
|
|
|
|
RANDOM_EXCUSE=${EXCUSES[$rand]}
|
|
|
|
MESSAGE="Gonna work from home. "$RANDOM_EXCUSE
|
|
|
|
|
|
|
|
# Send a text message
|
|
|
|
RESPONSE=`curl -fSs -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
|
|
|
|
-d "From=$MY_NUMBER" -d "To=$NUMBER_OF_BOSS" -d "Body=$MESSAGE" \
|
2015-11-23 13:55:17 -08:00
|
|
|
"https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages"`
|
2015-11-22 01:55:54 +04:00
|
|
|
|
|
|
|
# Log errors
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
echo "Failed to send SMS: $RESPONSE"
|
|
|
|
exit 1
|
|
|
|
fi
|