2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-22 18:37:10 +00:00
hacker-scripts/hangover.sh
Julio Ordonez Viales b9c6dad2c5 Update cron job to be executed on weekdays only
Updated the cron job so that it only executes the scripts on weekdays, that way there is not need to check for this condition inside the scripts, updated the scripts as well
2015-11-26 19:26:15 -06:00

33 lines
684 B
Bash
Executable File

#!/bin/sh -e
# Exit early if any session with my username is found
if who | grep -wq $USER; then
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" \
"https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages"`
# Log errors
if [ $? -gt 0 ]; then
echo "Failed to send SMS: $RESPONSE"
exit 1
fi