mirror of
https://github.com/narkoz/hacker-scripts
synced 2025-08-28 13:17:44 +00:00
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
32 lines
681 B
Bash
Executable File
32 lines
681 B
Bash
Executable File
#!/bin/sh -e
|
|
|
|
# Exit early if no sessions with my username are found
|
|
if ! who | grep -wq $USER; then
|
|
exit
|
|
fi
|
|
|
|
# Phone numbers
|
|
MY_NUMBER='+xxx'
|
|
HER_NUMBER='+xxx'
|
|
|
|
REASONS=(
|
|
'Working hard'
|
|
'Gotta ship this feature'
|
|
'Someone fucked the system again'
|
|
)
|
|
rand=$[ $RANDOM % ${#REASONS[@]} ]
|
|
|
|
RANDOM_REASON=${REASONS[$rand]}
|
|
MESSAGE="Late at work. "$RANDOM_REASON
|
|
|
|
# Send a text message
|
|
RESPONSE=`curl -fSs -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
|
|
-d "From=$MY_NUMBER" -d "To=$HER_NUMBER" -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
|