Select Page

Firstly you must create an xml plist file defining the path of the script and parameters. This file is put into ~/Library/LaunchAgents/nz.ac.auckland.sit.plist. Here is an example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>nz.ac.auckland.sit</string>
    <key>ProgramArguments</key>
    <array>
      <string>~/Application Scripts/nz.ac.auckland.sit/myscript.sh</string>
      <string>-p param -f file</string>
    </array>
  </dict>
</plist>

In this example the only things you need to change are

  • ~/Application Scripts/nz.ac.auckland.sit/myscript.sh: Change this to the path of your script.
  • -p param -f file: Change this to the parameters to send to the script

You will also need to set the permissions correctly.

chown root:wheel ~/Library/LaunchAgents/nz.ac.auckland.sit.plist
chown root:wheel ~/Application Scripts/nz.ac.auckland.sit/myscript.sh
chmod +x ~/Application Scripts/nz.ac.auckland.sit/myscript.sh
Skip to toolbar