@mh-cbon/upstart-simple-api

Simple and limited api to interface with upstart

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@mh-cbon/upstart-simple-api
Minified + gzip package size for @mh-cbon/upstart-simple-api in KB

Readme

upstart-simple-api

Simple and limited api to interface with upstart.

install

npm i @mh-cbon/upstart-simple-api --save

usage

Beware,

  • user jobs are not well tested because they cannot be initialized easily with a vagrant ubuntu box.
  • describe method is quiet limited in regard of upstart script language, it is intended.
var UpstartSimpleApi = require('@mh-cbon/upstart-simple-api');
var usapi = new UpstartSimpleApi(/* version */);

// initctl list
usapi.list(opts={}, function (err, items) {
  console.log(items);
})

// initctl show-config serviceId
sds.describe('serviceId', opts={}, function (err, info) {
  console.log(info);
})

// initctl start serviceId
sds.start('serviceId', opts={}, function (err) {
  console.log(err);
})

// initctl stop serviceId
sds.stop('serviceId', opts={}, function (err) {
  console.log(err);
})

// initctl reload serviceId
sds.reload('serviceId', function (err) {
  console.log(err);
})

// initctl reload-configuration serviceId
sds.reloadConfiguration('serviceId', function (err) {
  console.log(err);
})

Install a Service

// per user
var service = {
  user: true,
  id: 'fake',
  stanzas: [
    {
      name: 'author',
      value: 'whatever'
    },
    {
      name: 'exec',
      value: '/bin/sh ...'
    }
  ]
}
usapi.install(service, done)

// system wide
var service = {
  user: !true,
  id: 'fake',
  stanzas: [
    {
      name: 'author',
      value: 'whatever'
    },
    {
      name: 'exec',
      value: '/bin/sh ...'
    }
  ]
}
usapi.install(service, done)


// later...
usapi.uninstall(service, done)

read more

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.