Skip to content

Start on OS launch #9

@NV

Description

@NV

Make a postinstall npm hook for all major operating systems.

http://en.wikipedia.org/wiki/Init

Mac OS X

Create a ~/Library/LaunchAgents/com.chrome.devtools.autosave.launchd.plist file with the following content:

<?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>Label</key>
  <string>com.chrome.devtools.autosave.launchd</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/autosave</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
    <key>KeepAlive</key>
    <true/>
  <key>EnvironmentVariables</key>
  <dict>
    <key>PATH</key>
    <string>/usr/local/bin</string><!-- dirname $(which node) -->
  </dict>
    <key>StandardOutPath</key>
    <string>/var/log/autosave.log</string>
    <key>StandardErrorPath</key>
    <string>/var/log/autosave.error.log</string>
</dict>
</plist>

Make sure it works:

➤ launchctl load ~/Library/LaunchAgents/com.chrome.devtools.autosave.launchd.plist
➤ launchctl list | grep chrome
38609   -   com.chrome.devtools.autosave.launchd

Enjoy.

Windows

http://en.wikipedia.org/wiki/Windows_Registry#Command_line_editing

Linux

FreeBSD

rc.d

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions