Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

nssm (14) Versions 4.0.0

Installs/Configures NSSM

Policyfile
Berkshelf
Knife
cookbook 'nssm', '= 4.0.0', :supermarket
cookbook 'nssm', '= 4.0.0'
knife supermarket install nssm
knife supermarket download nssm
README
Dependencies
Changelog
Quality 67%

NSSM Cookbook

Cookbook Version
Build Status

This cookbook installs the Non-Sucking Service Manager (http://nssm.cc), and exposes resources to install
and remove Windows services.

Requirements

  • Chef 12.7+

Platform

  • Windows

Usage

Add recipe[nssm] to run list.

Quick Start

To install a Windows service:

nssm 'service name' do
  program 'C:\Windows\System32\java.exe'
  args '-jar C:/path/to/my-executable.jar'
  action :install
end

To remove a Windows service:

nssm 'service name' do
  action :remove
end

Using Parameters

A parameter is a hash key representing the same name as the registry entry which controls the associated functionality.
So, for example, the following sets the Startup directory, I/O redirection, and File rotation for a service:

nssm 'service name' do
  program 'C:\Windows\System32\java.exe'
  args '-jar C:/path/to/my-executable.jar'
  parameters(
    AppDirectory: 'C:/path/to',
    AppStdout: 'C:/path/to/log/service.log',
    AppStderr: 'C:/path/to/log/error.log',
    AppRotateFiles: 1
  )
  action %i[install start]
end

Attributes

  • node['nssm']['src'] - This can either be a URI or a local path to nssm zip.
  • node['nssm']['sha256'] - SHA-256 checksum of the file. Chef will not download it if the local file matches the checksum.

Resource/Provider

Actions

  • install - Install a Windows service, and update it accordingly. (Note: it will NOT automatically restart the service, make sure to notify the according service to restart)
  • install_if_missing - Install a Windows service, but do not update it if present (old behaviour)
  • remove - Remove Windows service.
  • start - Start the Windows service.
  • stop - Stop the Windows service.

Attribute Parameters

  • servicename - Name attribute. The name of the Windows service.
  • program - The program to be run as a service.
  • args - String of arguments for the program. Optional
  • parameters - Hash of key value pairs where key represents associated registry entry. Optional
  • start - Start service after installing. Default - true
  • nssm_binary - Path to nssm binary. Default - node['nssm']['install_location']\nssm.exe

ChefSpec Matchers

The NSSM cookbook includes custom ChefSpec matchers you can use to test your
own cookbooks that consume Windows cookbook LWRPs.

Example Matcher Usage

expect(chef_run).to install_nssm('service name').with(
  :program 'C:\Windows\System32\java.exe'
  :args '-jar C:/path/to/my-executable.jar'
)

NSSM Cookbook Matchers

  • install_nssm(servicename)
  • remove_nssm(servicename)

Getting Help

Contributing

Please refer to CONTRIBUTING.

License

MIT - see the accompanying LICENSE file for details.

NSSM CHANGELOG

4.0.0 2017-08-02

  • Convert default recipe to custom resource with idempotence
  • Allow install of nssm to be optional
  • Properly escape parameters in install action (custom quoting should be removed)
  • Make start service idempotent
  • Unstable version of nssm is used to ensure proper idempotency. Without it, the load_current_value would fail to get every setting.

3.0.2 2017-07-13

  • Fix whyrun issues

3.0.1 2017-07-07

  • Chef 12.7 or higher is now required
  • Fix parameters attribute

3.0.0 2017-03-24

  • Rename params attribute to parameters to be Chef 13 compatible

2.0.0 2016-10-03

  • Drop support for Chef 11

1.2.1 2016-04-12

  • Include default recipe in provide only if required

1.2.0 2015-08-09

  • Use new install_location attribute everywhere
  • Don't try to install nssm if it's already there

1.1.0 2015-02-06

  • Add an attribute for the install location of nssm.exe

1.0.0 2014-12-17

  • Remove deprecated matchers
  • Ensure nssm is being installed before service is installed

0.2.0 2014-10-08

  • Chef cache path no longer hard coded
  • Chefspec matchers comply with naming convention

0.1.0 2014-09-21

  • Initial release using nssm v2.24

Collaborator Number Metric
            

4.0.0 passed this metric

Contributing File Metric
            

4.0.0 passed this metric

Foodcritic Metric
            

4.0.0 failed this metric

FC117: Do not use kind_of in custom resource properties: nssm/resources/install.rb:4
FC117: Do not use kind_of in custom resource properties: nssm/resources/install_noop.rb:4
FC117: Do not use kind_of in custom resource properties: nssm/resources/service.rb:6
FC117: Do not use kind_of in custom resource properties: nssm/resources/service.rb:7
FC117: Do not use kind_of in custom resource properties: nssm/resources/service.rb:8
FC117: Do not use kind_of in custom resource properties: nssm/resources/service.rb:9
FC117: Do not use kind_of in custom resource properties: nssm/resources/service.rb:10
FC117: Do not use kind_of in custom resource properties: nssm/resources/service_noop.rb:5
FC117: Do not use kind_of in custom resource properties: nssm/resources/service_noop.rb:6
FC117: Do not use kind_of in custom resource properties: nssm/resources/service_noop.rb:7
FC117: Do not use kind_of in custom resource properties: nssm/resources/service_noop.rb:8
FC117: Do not use kind_of in custom resource properties: nssm/resources/service_noop.rb:10
FC118: Resource property setting name_attribute vs. name_property: nssm/resources/install.rb:3
FC118: Resource property setting name_attribute vs. name_property: nssm/resources/install_noop.rb:3
FC118: Resource property setting name_attribute vs. name_property: nssm/resources/service.rb:5
FC118: Resource property setting name_attribute vs. name_property: nssm/resources/service_noop.rb:4
Run with Foodcritic Version 14.0.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

4.0.0 passed this metric

Testing File Metric
            

4.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

4.0.0 passed this metric