Notepad/enter/Coding Tips (Classical)/Terminal Tips/Computers/Apple Macbook/BBEdit/plist.md

2.1 KiB

What is a plist?

.plists are simple XML document types used throughout Mac OS X. This format defines a set of primitive types, and is used within CLM for definition.


Create plist to trigger program to run at a specific time

  • This is done with the launchd agent on Mac OS
  • Make sure to place it under ~/Library/LaunchAgents. ~ denotes home directory.
~/Library/LaunchAgents/com.launchd.example.plist

Obsidian --> git workflow plist

instead of the cron tab

  • on MacOS use launchd service
  • store within ~/Library/LaunchAgents/us.shwetha.obsidian.plist for example
  • the XML path will be as follows:
# Creating a Obsidian.md ---> Gitlab workflow 

<?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>us.shwetha.obsidian</string>
    <key>ProgramArguments</key>
        <array>
            <string>/Users/shwethajayaraj/bin/zk_sync.sh</string>
        </array>
    <key>StartInterval</key>
    <integer>60</integer>
  </dict>
</plist>


###### another example ##########
### Runs bash /Users/Me/Desktop/push_release.sh on 3/22 at 11:11AM ###

?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>com.launchd.example</string>
    <key>ProgramArguments</key>
        <array>
            <string>bash</string> 
            <!-- This line isn't required if *.sh is already executable -->
            <string>/Users/Me/Desktop/push_release.sh</string>
        </array>
    <key>StartCalendarInterval</key>
    <dict>
      <key>Month</key>
      <integer>3</integer>
      <key>Day</key>
      <integer>22</integer>
      <key>Hour</key>
      <integer>11</integer>
      <key>Minute</key>
      <integer>11</integer>
    </dict>
  </dict>
</plist>