- Crontab Guru - Shows settings for custom times
Last active
September 14, 2018 20:47
-
-
Save ryanjohnston/6c9300945949d893c8f82547895c43bb to your computer and use it in GitHub Desktop.
[Crontab - Snippets] Gists, Snippets and Workflows #cli
Run cleanup operation for homebrew every Monday at 8:00 am
0 8 * * 1 /usr/local/bin/brew cleanup
Copy directory listing of dev folder to dropbox, every 30 minutes
0,30 * * * * /usr/local/bin/tree -d -L 1 dev > ~/Dropbox/config/trip/dev-directory.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# A script to monitor uptime of websites, | |
# and notify by email if a website is down. | |
SITES="ADD COMMA-SEPARATED WEBSITES HERE" | |
EMAILS="ADD COMMA-SEPARATED EMAILS HERE" | |
for SITE in $(echo $SITES | tr "," " "); do | |
if [ ! -z "${SITE}" ]; then | |
RESPONSE=$(curl -s --head $SITE) | |
if echo $RESPONSE | grep "200 OK" > /dev/null | |
then | |
echo "The HTTP Server on ${SITE} is up!" | |
else | |
MESSAGE="The HTTP server at ${SITE} has failed to respond." | |
for EMAIL in $(echo $EMAILS | tr "," " "); do | |
SUBJECT="${SITE} (http) Failed" | |
echo $MESSAGE | mail -s "$SUBJECT" $EMAIL | |
echo $SUBJECT | |
echo "Alert sent to $EMAIL" | |
done | |
fi | |
fi | |
done |
Will update homebrew at midnight and noon each day.
0 12 * * * /usr/local/bin/brew update
Will copy VSCode Projects json file to Dropbox every 30 minutes
0,30 * * * * /bin/cp -a ~/Library/Application\ Support/Code/User/projects.json ~/Dropbox/config/vscode-iridium/projects.json
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment