Skip to content

bbetter173/puppet-init_script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

init_script

Simple Puppet module for creating and managing init_scripts

  • Compatible with init.d, chkconfig and update-rc.
  • Creates an init script and service, and can ensure the service is running.
  • Supports running executables as different users.
  • Easily redirect all output to a logfile.

Module requirements

Usage

init_script { 'ffmpeg_input':
  daemon_name	=>	'ffmpeg_input',
  daemon_path	=>	'/usr/local/bin',
  daemon_bin 	=>	'ffmpeg',              
}

or

init_script { 'ffmpeg_input':
  daemon_name       =>      'ffmpeg_input',
  daemon_path       =>      '/usr/local/bin',
  daemon_bin        =>      'ffmpeg',
  daemon_opts       =>      '-i udp://127.0.0.1:5001 /tmp/test.mp4',
  daemon_env_setup  =>	    'ALSA_ENABLE=false',
  
}

Paramaters

####Required

  • daemon_name: The name for the daemon. This sets the "Provides: " metadata tag required for init.d systems, and processname for chkconfig. Type: string
  • daemon_path: The path to the daemon binary. Type: string
  • daemon_bin: The binary file to run. Type: string

####Optional

  • daemon_desc: The description to set in the chkconfig/lsb header. Type: string
  • daemon_user: The user to run the daemon as. Must exist already, specified by username. Type:string. Default: root
  • daemon_opts: Any options to pass to the daemon binary. Type: string
  • daemon_env_setup: A command that can be executed before the daemon binary is run, normally to setup the environment. Useful for virtualenv activate statements. Type: string
  • daemon_required_start: init.d systems only Defines any services that are required to start before this one. See lsb/init.d documentation for more details.
  • external_pid: Path to an external PID file, if one is created by the application. Useful if a wrapper script is used to launch it - echo the PID(s) of your application to a text file and set this parameter to the same path. Type: string
  • kill_by_name: If true, the init.d script will kill the process using pgrep combined with a process name and argument string. If this is set to true, kill_by_pid must be set to false explicitly, and you must supply kill_proc_name with an optional kill_proc_args. Use this with caution. This function is particularly useful if the application spawns several processes that don't die with the parent. See kill_proc_name and kill_proc_args for more information. Type: boolean. Default: false
  • kill_by_pid: If true, the init script will kill the process using its PID, whether this is obtained by the script or read from the file defined in external_pid. Type: boolean. Default: true
  • kill_proc_name: The process name to use with pgrep in order to kill the script. See pgrep documentation for more details. Note: pgrep accepts regular expressions in it's process names. Type: string
  • kill_proc_args: The process arguments to use with pgrep in order to kill the script. If supplied, pkill/pgrep are called with the -f flag supplying these as arguments. See prgep documentation for more details. Type: string
  • daemon_logfile: The logfile to redirect any stdout generated by the service to. Type: string. Default: /dev/null
  • chkconfig: The chkconfig runlevels string to supply in the header. See chkconfig documentation for more details.

Changelog

1.0.0

Initial release. Works with lsb and chkconfig.

Author

Benjamin Bettridge [email protected]
2014-11-19

License

Copyright 2014 Ben Bettridge

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

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Puppet module that creates init scripts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published