Skip to content

Instantly share code, notes, and snippets.

@sebandgo
Last active June 15, 2019 21:07
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 sebandgo/77cfe3336754fac9452d7a57d764b6d4 to your computer and use it in GitHub Desktop.
Save sebandgo/77cfe3336754fac9452d7a57d764b6d4 to your computer and use it in GitHub Desktop.
Mac CronJob to open and close specific applications
##
## Open Applications ##
##
59 5 * * * printf '3\n[USERNAME]\n[PASSWORD]\ny' | /opt/cisco/anyconnect/bin/vpn -s connect [VPN-HOSTNAME] > /dev/null 2>&1
0 6 * * * osascript -e 'open app "Slack"' > /dev/null 2>&1
0 6 * * * osascript -e 'open app "Fuze"' > /dev/null 2>&1
0 6 * * * osascript -e 'open app "Cisco AnyConnect Secure Mobility Client"' > /dev/null 2>&1
##
## Close Applications
##
59 22 * * * /opt/cisco/anyconnect/bin/vpn disconnect > /dev/null 2>&1
0 23 * * * osascript -e 'quit app "Slack"' > /dev/null 2>&1
0 23 * * * osascript -e 'quit app "Fuze"' > /dev/null 2>&1
0 23 * * * osascript -e 'quit app "Cisco AnyConnect Secure Mobility Client"' > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment