Skip to content

Instantly share code, notes, and snippets.

@mudpuddle
Last active December 27, 2015 11:59
Show Gist options
  • Save mudpuddle/7322579 to your computer and use it in GitHub Desktop.
Save mudpuddle/7322579 to your computer and use it in GitHub Desktop.
launchd script to open webpage everyday at a certain time

The plist file goes one of 3 places:

  • System Tasks - /Library/LaunchDaemons/
  • If Any User Logged In - /Library/LaunchAgents/
  • Only If You Are Logged In - ~/Library/LaunchAgents/

The script can be anywhere, but it needs to be executable

chmod 755 --path to script file

In the LaunchAgent folder type the following... launchctl load open.webpage.plist

#!/bin/sh
open http://www.google.com
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AbandonProcessGroup</key>
<true/>
<key>Label</key>
<string>open.webpage.plist</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>/<path to script>/open-webpage.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>10</integer>
<key>Minute</key>
<integer>00</integer>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment