Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

user-startup

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

user-startup

Automatically run commands when the user logs in (cross-platform)

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

user-startup Build Status npm version

Automatically run commands when the user logs in. Used in hotel and stop-server.

  • No admin privileges required
  • Cross-platform (OS X, Linux and Windows)

Install

npm install user-startup --save

Example

const startup = require('user-startup')

const nodePath = process.execPath
const args = ['/some/path/app.js']
const out = '/some/path/out.log'

// Creates startup script and spawns process
startup.create('my-script', nodePath, args, out)

// Removes startup script
startup.remove('my-script')

Note: you should check that root isn't running this code to avoid startup scripts being created in root's home directory. Use sudo-block or is-root.

API

add(id, cmd[, args[, out]])

  • id <String> id
  • cmd <String> command
  • args <Array> optional list of string arguments
  • out <String> optional path to output file (directory needs to exist before)

Creates startup script.

create(id, cmd[, args[, out]])

Creates a startup script and spawns process.

remove(id)

Removes startup script.

dir

Returns startup script directory.

getFile(id)

Returns startup script path.

How it works

  • On OS X, it creates a plist file in ~/Library/LaunchAgents
  • On Linux, it creates a desktop file in ~/.config/autostart
  • On Windows, it creates a vbs script in AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

License

MIT - Typicode

Keywords

FAQs

Package last updated on 30 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc