Under OAuth & Permissions → Scopes, add Bot Token Scopes:
chat:write
channels:read
(optional) chat:write.public if you want to post in channels without inviting the bot
Install the app to your workspace and authorize
Copy the Bot User OAuth Token (xoxb-…) and the Channel ID (e.g. C01234567)
2. Clone the repo
As sudo, clone into /etc:
cd /etc
sudo git clone https://github.com/bionicvisionlab/automations bvl-automations
Make sure the bash script is executable (it should already be):
cd bvl-automations
chmod +x disk_sentinel.sh
3. Configure the sentinel
In /etc/bvl-automations, create a file called .disk_sentinel.conf and export
the following variables:
SLACK_BOT_TOKEN="xoxb-…" # from Slack Apps
SLACK_CHANNEL_ID="C01234567" # from channel info
THRESHOLD=90 # percentage
MOUNT_POINTS="/home /hdd" # optional
RECOVERY_OFFSET=5 # optional, drop 5% to restore normality
RENOTIFICATION_MINUTES=240 # optional, nag every 240 mins
Then lock it down:
chmod 600 .disk_sentinel.conf
4. Add to root’s crontab
File lock: This wrapper checks if the script is already running. If it is, the new cron job simply quits immediately.
disk_sentinel.log: Write output to a log file so the job doesn’t fail silently.
sudo crontab -e
# add a line to run it every 10 mins:
*/10 * * * * /usr/bin/flock -n /var/lock/disk_sentinel.lock /etc/bvl-automations/disk_sentinel.sh >> /var/log/disk_sentinel.log 2>&1
Bionic Vision Lab Automations
Automations used around the lab.
ZotBot
Runs every 5 minutes using GitHub Actions.
DiskSentinel
DiskSentinel monitors disk usage and alerts Slack with a per-user /home or /hdd breakdown.
1. Create & Configure a Slack App
Go to https://api.slack.com/apps and click Create New App → From scratch
Name it DiskSentinel, select your workspace
Under OAuth & Permissions → Scopes, add Bot Token Scopes:
chat:writechannels:readchat:write.publicif you want to post in channels without inviting the botInstall the app to your workspace and authorize
Copy the Bot User OAuth Token (
xoxb-…) and the Channel ID (e.g.C01234567)2. Clone the repo
As
sudo, clone into/etc:Make sure the bash script is executable (it should already be):
3. Configure the sentinel
In
/etc/bvl-automations, create a file called.disk_sentinel.confand export the following variables:Then lock it down:
4. Add to root’s crontab
File lock: This wrapper checks if the script is already running. If it is, the new cron job simply quits immediately.
disk_sentinel.log: Write output to a log file so the job doesn’t fail silently.