Skip to content
This repository was archived by the owner on Jun 4, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions OSXPLIST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Running as a "service"/daemon on OS X
--------------------------------------

airsonos can be set to launch at system boot, and automatically restarted when/if it crashes. By installing it this way, you can also start/stop the service versus manually killing the app.

1. Install airsonos per the directions.
2. Create a file called **local.airsonos.plist** using your favorite text editor (vi/Atom/SublimeText/etc).
3. Copy the code below into the file, and save it. It tells OS X to start the app at boot, and to restart it if it crashes for any reason.
```
<?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">
<?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>local.airsonos</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>/usr/local/bin/airsonos</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardInPath</key>
<string>/tmp/local.airsonos.stdin</string>
<key>StandardOutPath</key>
<string>/tmp/local.airsonos.stdout</string>
<key>StandardErrorPath</key>
<string>/tmp/local.airsonos.stderr</string>
</dict>
</plist>
```
4. Copy the file to /Library/LaunchDaemons
in /Library/LaunchDaemons:
```
sudo cp local.airsonos.plist /Library/LaunchDaemons
```
5. Install and start the daemon:
```
sudo launchctl load -w /Library/LaunchDaemons/local.airsonos.plist
```

If you need to remove the service for some reason, simply:
```
sudo launchctl unload -w /Library/LaunchDaemons/local.airsonos.plist
sudo rm /Library/LaunchDaemons/local.airsonos.plist
```

Enjoy!
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ $ npm install airsonos -g

Platform-specific install note available from [`INSTALL.md`](https://github.com/stephen/airsonos/blob/master/INSTALL.md)

Example to run it as a service in OS X from [`OSXPLIST.md`](https://github.com/stephen/airsonos/blob/master/OSXPLIST.md)

Example usage
-------------
```
Expand Down