~/hacker-scripts-office

bash · cron · curl · zero dependencies

Office Hacker Scripts
on a schedule.

A small, silly collection of cron-driven office automation — the classic Hacker Scripts gag rebuilt so every prank is a standalone command-line script, cron-safe, and configured entirely from environment variables in one config file.

Four scripts, four bad ideas

Each one runs by hand or from cron. Each one honours DRY_RUN=1 so you can watch the decision logic without sending anything.

excuse.sh

Texts a random made-up excuse when someone is still logged in after hours.

cron
*/15 18-23 * * 1-5
reads
who / w -h
sends
Twilio · webhook · signal-cli
after hours

sickday.sh

Emails a sick note in the morning if nobody is logged in — the joke being that absence is taken as illness.

cron
0 8 * * 1-5
reads
who / w -h
sends
msmtp · sendmail · SMTP
morning

autoreply.sh

Scans IMAP for mail from one sender and replies once per message, threaded and deduplicated.

cron
*/5 * * * *
reads
IMAP UNSEEN FROM
dedupe
Message-ID in state/
inbox watch

coffee.sh

Waits a bit, then triggers the network coffee machine over HTTP or an arbitrary shell command.

cron
0 9 * * 1-5
waits
COFFEE_DELAY_SECONDS
or until
COFFEE_AT=09:05
delayed trigger

Dry-run console

Set the conditions, then run. This mirrors the real branch order in the shell scripts — nothing is sent, and the log lines are the ones the scripts actually print.

all four scripts · DRY_RUN=1
Scenario
Logged-in sessions
Mail from watched sender
Cooldown state
# flip the conditions and hit Run dry-run

Every line above is real output from DRY_RUN=1 runs.

Configuration

Everything lives in one shell file, config/config.env. The full documented list is in the example file; these are the ones you'll actually touch.

Configuration variables
VariableDefaultWhat it does
DRY_RUN01 = log decisions, send nothing, call no APIs
SMS_PROVIDERtwilionone · twilio · webhook · signal
NOTIFY_TO—Destination for SMS/chat: phone number or chat id
EMAIL_FROM / EMAIL_TO—Sender and recipient for email-backed scripts
WORK_START_HOUR / WORK_END_HOUR9 / 18What counts as “after hours”
WORKDAYS1,2,3,4,5ISO weekday numbers (1 = Mon)
MIN_SESSIONS1Sessions required before an excuse goes out
EXCUSE_COOLDOWN_MINUTES120Anti-spam window; what makes */15 cron safe
SICKDAY_HOUR8Only fire the sick note at this local hour
WATCH_SENDER—Whose mail triggers the auto-reply
AUTOREPLY_LIMIT5Max replies per run
COFFEE_DELAY_SECONDS300“Wait a bit” before brewing

Secrets stay out of the repo. config/config.env is git-ignored; only the placeholder example is committed. Use an app password for IMAP, never your main one.

Cron

Cron runs with a minimal $PATH and no shell rc files, so set the path and config variables at the top. Always redirect output, or cron will try to email you.

SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
HACKER_SCRIPTS=/opt/hacker-scripts-office
HACKER_SCRIPTS_CONFIG=$HACKER_SCRIPTS/config/config.env

# weeknight evenings: still logged in? text an excuse
*/15 18-23 * * 1-5 $HACKER_SCRIPTS/scripts/excuse.sh   >> $HACKER_SCRIPTS/state/excuse.log 2>&1
# weekday 08:00: nobody logged in? email a sick note
0 8 * * 1-5        $HACKER_SCRIPTS/scripts/sickday.sh  >> $HACKER_SCRIPTS/state/sickday.log 2>&1
# every 5 minutes: watch one sender, reply once
*/5 * * * *        $HACKER_SCRIPTS/scripts/autoreply.sh >> $HACKER_SCRIPTS/state/autoreply.log 2>&1
# weekday 09:00: wait, then brew
0 9 * * 1-5        $HACKER_SCRIPTS/scripts/coffee.sh   >> $HACKER_SCRIPTS/state/coffee.log 2>&1

Install

Needs bash and curl. Add python3 for the IMAP watcher, and a mail transport (msmtp, sendmail, or SMTP) for the email scripts.

git clone https://github.com/ArthurzWong/hacker-scripts-office.git
cd hacker-scripts-office && ./install.sh
  1. Set it up

    Run ./install.sh — makes the scripts executable, creates config/config.env from the example, and creates state/.

  2. Fill in your details

    Edit config/config.env: message backend, email backend, work hours, and the sender to watch.

  3. Check and preview

    Run ./scripts/doctor.sh for a read-only status report, then make test for 17 dry-run checks across every script.

  4. Arm cron last

    Paste the lines you want from cron/crontab.example into crontab -e. Nothing runs until you do.

This is a joke repo. It's for demos, hackdays, and laughing at your own build pipeline — not for deceiving your employer or your team. Point it at yourself or a test mailbox before pointing it at anyone else.