Skip to content

Instantly share code, notes, and snippets.

@brandonpittman
Created December 11, 2016 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonpittman/ccb86fe9db05c3b16c2e2446c5537feb to your computer and use it in GitHub Desktop.
Save brandonpittman/ccb86fe9db05c3b16c2e2446c5537feb to your computer and use it in GitHub Desktop.
Create OmniFocus task to restart Mac if uptime > 7 days
#!/usr/bin/awk -f
BEGIN {
cmd="uptime"
cmd | getline output
if (output ~ /up ([7-9]|[[:digit:]][[:digit:]]) days/) {
system("osascript -e \'tell application \"Omnifocus\" to parse tasks into default document with transport text \"Restart iMac! @home ::misc //"output"\"\'")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment