Skip to content

Instantly share code, notes, and snippets.

@jsfaint
Created September 14, 2017 02:24
Show Gist options
  • Save jsfaint/a746565084421929c003895fb74791d8 to your computer and use it in GitHub Desktop.
Save jsfaint/a746565084421929c003895fb74791d8 to your computer and use it in GitHub Desktop.
Push message to wechat via serverchan, when disk space threshold is triggered
#!/bin/bash
avail=$(df / | tail -n 1 | awk '{print $4}')
threshold=""
message="硬盘要满啦"
token=""
if [[ ${avail:?} -lt ${threshold:?} ]]; then
curl "https://sc.ftqq.com/${token:?}.send?text=${message:?}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment