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


service_factory (4) Versions 0.1.2

LWRPs to generate services using native system features and service managers. (SysV, Upstart, ...)

cookbook 'service_factory', '= 0.1.2', :supermarket
cookbook 'service_factory', '= 0.1.2'
knife supermarket install service_factory
knife supermarket download service_factory
Quality -%

service_factory cookbook

Cookbook for Opscode Chef.

Fully functional … documentation WIP, and example usages coming soon !!


Generate services using native system features with the service_factory LWRPs.

Your recipe provides the configuration details, and the necessary files are generated to create a SysV or Upstart service, depending on what each OS prefers. (SystemD coming soon!!)

Supported Service Managers

  • SysV (init.d, chkconfig, etc.)
  • Upstart (Ubuntu, Debian, etc.)

Supported Operating Systems
The following are supported and verified through test-kitchen automated integration testing.

  • Centos
  • Ubuntu

Default Service Managers

Unless otherwise specified in the service_factory global config, the default service manager is SysV, and
others are selected conditionally based on the distribution and version.

You can customize these defaults by adjusting the 'platform_map' node attribute, described below.


Cookbooks:: unix_bin , resource_masher , run_action_now

Resource attributes:: service_desc , exec , run_user , run_group

Resource Documentation


:create , :delete , :start , :stop , :restart , :enable , :disable

Note: You can also use a standard Chef service resource to manage the service once created.


:attribute       = default
    description (type)
    Simple name of service. Defaults to resource name. (/^[a-z0-9_]+$/i)

    Short description of service. (Required)

    Name or id of user to run service under. (Required)

    Name or id of group to run service under. (Required)

    Full path to executable binary. (Required)

:exec_args      = ""
    Command line args to executable. (String or Array)

:exec_umask     = "0027"
    umask set before execution

:exec_forks     = false
    Does executable fork at startup? (Important)

:process_name   = basename %{exec}
    Used to detect status and stop service.

:kill_timeout   = 5
    Number of seconds to wait before killing at stop/shutdown.

:before_start   = ""
    Shell commands to run before starting service.

:after_start    = ""
    Shell commands to run after starting service.

:before_stop    = ""
    Shell commands to run before stopping service.

:after_stop     = ""
    Shell commands to run after stopping service.

:base_path      = ""
    Prefix to FHS paths.
    Ex. "/srv/myapp" => "/srv/myapp/etc/"

:var_subpath    = ( %{run_user} == 'root'  ?  %{run_group}  :  %{service_name} )
    Suffix added to var directories.
    Ex. "myapp" => "/var/run/myapp/"

:lock_file      = %{base_path}/var/lock/subsys/%{service_name}
    Full path to lock file.

:log_file       = %{base_path}/var/log/%{var_subpath}/%{service_name}.log
    Full path to log file.

:log_what       = :none
    What service output should be logged. (:std_out  :std_err  :std_all  :none)

:pid_file {base_path}/var/run/{var_subpath}/{service_name}.pid
    Full path to pid file.

:create_pid     = %{exec_forks}  ?  false  :  true
    If true the factory creates a pid file, otherwise the daemon should create it.

:path_variables =
    Additional variables injectable into path strings.


This cookbook only provides LWRPs, no recipes are included.


The following default node attributes govern the platform selection.
You may customize the operation by appending/overwriting these in your node configuration.

default["service_factory"]["platform_map"]["default"] = "init"
default["service_factory"]["platform_map"]["ubuntu"]["default"] = "upstart"


This package is test-kitchen enabled and automatically tested against:

  • CentOS 5 and 6
  • Ubuntu 10 and 12

A successful test appears as follows:

-----> Running bats test suite
       ok 1 non-forked service
       ok 2 forked service
       ok 3 sighup restart (non-forked)
       ok 4 sighup restart (forked)
       ok 5 nobody service
       ok 6 deleted service
       Finished verifying  (1m18.10s).

Tested system service provided by Unix Mock Service Daemon

Development and Maintenance

  • Found a bug?
  • Need some help?
  • Have a suggestion?
  • Want to contribute?

Please visit:

Authors and License

  • Author:: BinaryBabel OSS (
  • Copyright:: 2013 sha1(OWNER) = df334a7237f10846a0ca302bd323e35ee1463931
  • License:: Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

No quality metric results found