microwave 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/Rakefile +4 -4
  2. data/bin/chef-solo +2 -0
  3. data/spec/spec_helper.rb +2 -0
  4. data/spec/unit/checksum/storage/filesystem_spec.rb +4 -4
  5. data/spec/unit/config_spec.rb +7 -4
  6. data/spec/unit/data_bag_spec.rb +11 -11
  7. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +8 -8
  8. data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +5 -5
  9. metadata +10 -124
  10. data/distro/README +0 -2
  11. data/distro/arch/etc/conf.d/chef-client.conf +0 -5
  12. data/distro/arch/etc/conf.d/chef-expander.conf +0 -8
  13. data/distro/arch/etc/conf.d/chef-server-webui.conf +0 -10
  14. data/distro/arch/etc/conf.d/chef-server.conf +0 -10
  15. data/distro/arch/etc/conf.d/chef-solr.conf +0 -8
  16. data/distro/arch/etc/rc.d/chef-client +0 -90
  17. data/distro/arch/etc/rc.d/chef-expander +0 -78
  18. data/distro/arch/etc/rc.d/chef-server +0 -78
  19. data/distro/arch/etc/rc.d/chef-server-webui +0 -78
  20. data/distro/arch/etc/rc.d/chef-solr +0 -78
  21. data/distro/common/html/chef-client.8.html +0 -145
  22. data/distro/common/html/chef-expander.8.html +0 -164
  23. data/distro/common/html/chef-expanderctl.8.html +0 -146
  24. data/distro/common/html/chef-server-webui.8.html +0 -185
  25. data/distro/common/html/chef-server.8.html +0 -182
  26. data/distro/common/html/chef-solo.8.html +0 -191
  27. data/distro/common/html/chef-solr.8.html +0 -165
  28. data/distro/common/html/knife-bootstrap.1.html +0 -241
  29. data/distro/common/html/knife-client.1.html +0 -219
  30. data/distro/common/html/knife-configure.1.html +0 -170
  31. data/distro/common/html/knife-cookbook-site.1.html +0 -241
  32. data/distro/common/html/knife-cookbook.1.html +0 -384
  33. data/distro/common/html/knife-data-bag.1.html +0 -238
  34. data/distro/common/html/knife-environment.1.html +0 -267
  35. data/distro/common/html/knife-exec.1.html +0 -134
  36. data/distro/common/html/knife-index.1.html +0 -125
  37. data/distro/common/html/knife-node.1.html +0 -250
  38. data/distro/common/html/knife-recipe.1.html +0 -92
  39. data/distro/common/html/knife-role.1.html +0 -200
  40. data/distro/common/html/knife-search.1.html +0 -288
  41. data/distro/common/html/knife-ssh.1.html +0 -156
  42. data/distro/common/html/knife-status.1.html +0 -128
  43. data/distro/common/html/knife-tag.1.html +0 -137
  44. data/distro/common/html/knife.1.html +0 -320
  45. data/distro/common/html/shef.1.html +0 -283
  46. data/distro/common/man/man1/knife-bootstrap.1 +0 -201
  47. data/distro/common/man/man1/knife-client.1 +0 -99
  48. data/distro/common/man/man1/knife-configure.1 +0 -88
  49. data/distro/common/man/man1/knife-cookbook-site.1 +0 -145
  50. data/distro/common/man/man1/knife-cookbook.1 +0 -345
  51. data/distro/common/man/man1/knife-data-bag.1 +0 -136
  52. data/distro/common/man/man1/knife-environment.1 +0 -178
  53. data/distro/common/man/man1/knife-exec.1 +0 -46
  54. data/distro/common/man/man1/knife-index.1 +0 -29
  55. data/distro/common/man/man1/knife-node.1 +0 -134
  56. data/distro/common/man/man1/knife-role.1 +0 -88
  57. data/distro/common/man/man1/knife-search.1 +0 -280
  58. data/distro/common/man/man1/knife-ssh.1 +0 -79
  59. data/distro/common/man/man1/knife-status.1 +0 -29
  60. data/distro/common/man/man1/knife-tag.1 +0 -43
  61. data/distro/common/man/man1/knife.1 +0 -288
  62. data/distro/common/man/man1/shef.1 +0 -256
  63. data/distro/common/man/man8/chef-client.8 +0 -104
  64. data/distro/common/man/man8/chef-expander.8 +0 -97
  65. data/distro/common/man/man8/chef-expanderctl.8 +0 -62
  66. data/distro/common/man/man8/chef-server-webui.8 +0 -155
  67. data/distro/common/man/man8/chef-server.8 +0 -147
  68. data/distro/common/man/man8/chef-solo.8 +0 -158
  69. data/distro/common/man/man8/chef-solr.8 +0 -122
  70. data/distro/common/markdown/README +0 -3
  71. data/distro/common/markdown/man1/knife-bootstrap.mkd +0 -141
  72. data/distro/common/markdown/man1/knife-client.mkd +0 -103
  73. data/distro/common/markdown/man1/knife-configure.mkd +0 -70
  74. data/distro/common/markdown/man1/knife-cookbook-site.mkd +0 -123
  75. data/distro/common/markdown/man1/knife-cookbook.mkd +0 -263
  76. data/distro/common/markdown/man1/knife-data-bag.mkd +0 -121
  77. data/distro/common/markdown/man1/knife-environment.mkd +0 -151
  78. data/distro/common/markdown/man1/knife-exec.mkd +0 -37
  79. data/distro/common/markdown/man1/knife-index.mkd +0 -30
  80. data/distro/common/markdown/man1/knife-node.mkd +0 -130
  81. data/distro/common/markdown/man1/knife-role.mkd +0 -85
  82. data/distro/common/markdown/man1/knife-search.mkd +0 -180
  83. data/distro/common/markdown/man1/knife-ssh.mkd +0 -69
  84. data/distro/common/markdown/man1/knife-status.mkd +0 -36
  85. data/distro/common/markdown/man1/knife-tag.mkd +0 -39
  86. data/distro/common/markdown/man1/knife.mkd +0 -218
  87. data/distro/common/markdown/man1/shef.mkd +0 -189
  88. data/distro/common/markdown/man8/chef-client.mkd +0 -74
  89. data/distro/common/markdown/man8/chef-expander.mkd +0 -82
  90. data/distro/common/markdown/man8/chef-expanderctl.mkd +0 -58
  91. data/distro/common/markdown/man8/chef-server-webui.mkd +0 -121
  92. data/distro/common/markdown/man8/chef-server.mkd +0 -121
  93. data/distro/common/markdown/man8/chef-solo.mkd +0 -107
  94. data/distro/common/markdown/man8/chef-solr.mkd +0 -89
  95. data/distro/debian/etc/default/chef-client +0 -4
  96. data/distro/debian/etc/default/chef-expander +0 -8
  97. data/distro/debian/etc/default/chef-server +0 -9
  98. data/distro/debian/etc/default/chef-server-webui +0 -9
  99. data/distro/debian/etc/default/chef-solr +0 -8
  100. data/distro/debian/etc/init.d/chef-client +0 -210
  101. data/distro/debian/etc/init.d/chef-expander +0 -176
  102. data/distro/debian/etc/init.d/chef-server +0 -122
  103. data/distro/debian/etc/init.d/chef-server-webui +0 -123
  104. data/distro/debian/etc/init.d/chef-solr +0 -176
  105. data/distro/debian/etc/init/chef-client.conf +0 -17
  106. data/distro/debian/etc/init/chef-expander.conf +0 -17
  107. data/distro/debian/etc/init/chef-server-webui.conf +0 -17
  108. data/distro/debian/etc/init/chef-server.conf +0 -17
  109. data/distro/debian/etc/init/chef-solr.conf +0 -17
  110. data/distro/redhat/etc/init.d/chef-client +0 -121
  111. data/distro/redhat/etc/init.d/chef-expander +0 -104
  112. data/distro/redhat/etc/init.d/chef-server +0 -112
  113. data/distro/redhat/etc/init.d/chef-server-webui +0 -112
  114. data/distro/redhat/etc/init.d/chef-solr +0 -104
  115. data/distro/redhat/etc/logrotate.d/chef-client +0 -8
  116. data/distro/redhat/etc/logrotate.d/chef-expander +0 -8
  117. data/distro/redhat/etc/logrotate.d/chef-server +0 -8
  118. data/distro/redhat/etc/logrotate.d/chef-server-webui +0 -8
  119. data/distro/redhat/etc/logrotate.d/chef-solr +0 -8
  120. data/distro/redhat/etc/sysconfig/chef-client +0 -15
  121. data/distro/redhat/etc/sysconfig/chef-expander +0 -7
  122. data/distro/redhat/etc/sysconfig/chef-server +0 -14
  123. data/distro/redhat/etc/sysconfig/chef-server-webui +0 -14
  124. data/distro/redhat/etc/sysconfig/chef-solr +0 -8
  125. data/distro/windows/service_manager.rb +0 -164
@@ -1,121 +0,0 @@
1
- chef-server(8) - Start the Chef Server merb application slice.
2
- ========================================
3
-
4
- ## SYNOPSIS
5
-
6
- __chef-server__ _(options)_
7
-
8
- * `-u`, `--user USER`:
9
- This flag is for having chef-server-webui run as a user other than the
10
- one currently logged in. Note: if you set this you must also provide a
11
- --group option for it to take effect.
12
- * `-G`, `--group GROUP`:
13
- This flag is for having chef-server-webui run as a group other than the
14
- one currently logged in. Note: if you set this you must also provide a
15
- --user option for it to take effect.
16
- * `-d`, `--daemonize`:
17
- This will run a single chef-server-webui in the background.
18
- * `-N`, `--no-daemonize`:
19
- This will allow you to run a cluster in console mode.
20
- * `-c`, `--cluster-nodes NUM_MERBS`:
21
- Number of merb daemons to run for chef-server-webui.
22
- * `-I`, `--init-file FILE`:
23
- File to use for initialization on load, defaults to config/init.rb.
24
- * `-p`, `--port PORTNUM`:
25
- Port to run chef-server-webui on, defaults to 4040. Additional nodes (-c)
26
- listen on incrementing port numbers.
27
- * `-o`, `--socket-file FILE`:
28
- Socket file to run chef-server-webui on, defaults to
29
- [Merb.root]/log/merb.sock. This is for web servers, like thin, that use
30
- sockets. Specify this *only* if you *must*.
31
- * `-s`, `--socket SOCKNUM`:
32
- Socket number to run chef-server-webui on, defaults to 0.
33
- * `-n`, `--name NAME`:
34
- Set the name of the application. This is used in the process title and
35
- log file names.
36
- * `-P`, `--pid PIDFILE`:
37
- PID file, defaults to [Merb.root]/log/merb.main.pid for the master
38
- process and[Merb.root]/log/merb.[port number].pid for worker processes.
39
- For clusters, use %s to specify where in the file chef-server-webui
40
- should place the port number. For instance: -P myapp.%s.pid.
41
- * `-h`, `--host HOSTNAME`:
42
- Host to bind to (default is 0.0.0.0).
43
- * `-m`, `--merb-root PATH_TO_APP_ROOT`:
44
- The path to the Merb.root for the app you want to run
45
- (default is current working directory).
46
- * `-a`, `--adapter ADAPTER`:
47
- The rack adapter to use to run chef-server-webui (default is mongrel)
48
- [mongrel, emongrel, thin, ebb, fastcgi, webrick].
49
- * `-R`, `--rackup FILE`:
50
- Load an alternate Rack config file (default is config/rack.rb).
51
- * `-i`, `--irb-console`:
52
- This flag will start chef-server-webui in irb console mode. All your models
53
- and other classes will be available for you in an irb session.
54
- * `-S`, `--sandbox`:
55
- This flag will enable a sandboxed irb console. If your ORM supports
56
- transactions, all edits will be rolled back on exit.
57
- * `-l`, `--log-level LEVEL`:
58
- Log levels can be set to any of these options:
59
- debug < info < warn < error < fatal (default is info).
60
- * `-L`, `--log LOGFILE`:
61
- A string representing the logfile to use. Defaults to
62
- [Merb.root]/log/merb.[main].log for the master process and
63
- [Merb.root]/log/merb[port number].logfor worker processes.
64
- * `-e`, `--environment STRING`:
65
- Environment to run Merb under [development, production, testing]
66
- (default is development).
67
- * `-r`, `--script-runner ['RUBY CODE'| FULL_SCRIPT_PATH]`:
68
- Command-line option to run scripts and/or code in the chef-server-webui
69
- app.
70
- * `-K`, `-graceful PORT or all`:
71
- Gracefully kill chef-server-webui proceses by port number.
72
- Use chef-server -K all to gracefully kill all merbs.
73
- * `-k`, `--kill PORT`:
74
- Force kill one merb worker by port number. This will cause the worker
75
- to be respawned.
76
- * `--fast-deploy`:
77
- Reload the code, but not yourinit.rb or gems.
78
- * `-X`, `--mutex on/off`:
79
- This flag is for turning the mutex lock on and off.
80
- * `-D`, `--debugger`:
81
- Run chef-server-webui using rDebug.
82
- * `-V`, `--verbose`:
83
- Print extra information.
84
- * `-C`, `--console-trap`:
85
- Enter an irb console on ^C.
86
- * `-?`, `-H`, `--help`:
87
- Show this help message.
88
-
89
- ## DESCRIPTION
90
-
91
- The Chef Server provides a central point for the distribution of Cookbooks,
92
- management and authentication of Nodes, and the use of Search. It provides
93
- a REST API.
94
-
95
- The API service is what clients use to interact with the server to manage
96
- node configuration in Chef. By default, the service is started on port 4000
97
- as a Merb application slice running with the thin server adapter.
98
-
99
- The two methods of interaction with the API for humans are the command-line
100
- tool Knife and the Management Console. The Chef Client library is used for
101
- interacting with the API for client nodes.
102
-
103
- ## SEE ALSO
104
-
105
- __chef-client__(8)
106
- __chef-server-webui__(8)
107
- __knife__(1)
108
-
109
- Full documentation for Chef and chef-server is located on the Chef
110
- wiki, http://wiki.opscode.com/display/chef/Home.
111
-
112
- ## AUTHOR
113
-
114
- Chef was written by Adam Jacob <adam@ospcode.com> of Opscode
115
- (http://www.opscode.com), with contributions from the community. This
116
- manual page was written by Joshua Timberman <joshua@opscode.com> with
117
- help2man. Permission is granted to copy, distribute and / or modify
118
- this document under the terms of the Apache 2.0 License.
119
-
120
- On Debian systems, the complete text of the Apache 2.0 License can be
121
- found in /usr/share/common-licenses/Apache-2.0.
@@ -1,107 +0,0 @@
1
- chef-solo(8) -- Runs chef in solo mode against a specified cookbook location.
2
- ========================================
3
-
4
- ## SYNOPSIS
5
-
6
- __chef-solo__ _(options)_
7
-
8
- * `-c`, `--config CONFIG`:
9
- The configuration file to use
10
- * `-d`, `--daemonize`:
11
- Daemonize the process
12
- * `-g`, `--group GROUP`:
13
- Group to set privilege to
14
- * `-i`, `--interval SECONDS`:
15
- Run chef-client periodically, in seconds
16
- * `-j`, `--json-attributes JSON_ATTRIBS`:
17
- Load attributes from a JSON file or URL
18
- * `-l`, `--log_level LEVEL`:
19
- Set the log level (debug, info, warn, error, fatal)
20
- * `-L`, `--logfile LOGLOCATION`:
21
- Set the log file location, defaults to STDOUT - recommended for
22
- daemonizing
23
- * `-N`, `--node-name NODE_NAME`:
24
- The node name for this client
25
- * `-r`, `--recipe-url RECIPE_URL`:
26
- Pull down a remote gzipped tarball of recipes and untar it to the
27
- cookbook cache.
28
- * `-s`, `--splay SECONDS`:
29
- The splay time for running at intervals, in seconds
30
- * `-u`, `--user USER`:
31
- User to set privilege to
32
- * `-v`, `--version`:
33
- Show chef version
34
- * `-h`, `--help`:
35
- Show this message
36
-
37
- ## DESCRIPTION
38
-
39
- Chef Solo allows you to run Chef Cookbooks in the absence of a Chef Server.
40
- To do this, the complete cookbook needs to be present on disk.
41
-
42
- By default Chef Solo will look in /etc/chef/solo.rb for its configuration.
43
- This configuration file has two required variables: file_cache_path and
44
- cookbook_path.
45
-
46
- For example:
47
- file_cache_path "/var/chef-solo"
48
- cookbook_path "/var/chef-solo/cookbooks"
49
-
50
- For your own systems, you can change this to reflect any directory you like,
51
- but you'll need to specify absolute paths and the cookbook_path directory
52
- should be a subdirectory of the file_cache_path.
53
-
54
- You can also specify cookbook_path as an array, passing multiple locations
55
- to search for cookbooks.
56
-
57
- For example:
58
- file_cache_path "/var/chef-solo"
59
- cookbook_path ["/var/chef-solo/cookbooks", "/var/chef-solo/site-cookbooks"]
60
-
61
- Note that earlier entries are now overridden by later ones.
62
-
63
- Since chef-solo doesn't have any interaction with a Chef Server, you'll need
64
- to specify node-specifc attributes in a JSON file. This can be located on the
65
- target system itself, or it can be stored on a remote server such as S3, or a
66
- web server on your network.
67
-
68
- Within the JSON file, you'll also specify the recipes that Chef should run in
69
- the "run_list". An example JSON file, which sets a resolv.conf:
70
-
71
- {
72
- "resolver": {
73
- "nameservers": [ "10.0.0.1" ],
74
- "search":"int.example.com"
75
- },
76
- "run_list": [ "recipe[resolver]" ]
77
- }
78
-
79
- Then you can run chef-solo with -j to specify the JSON file. It will look for
80
- cookbooks in the cookbook_path configured in the configuration file, and apply
81
- attributes and use the run_list from the JSON file specified.
82
-
83
- You can use -c to specify the path to the configuration file (if you don't want
84
- chef-solo to use the default). You can also specify -r for a cookbook tarball.
85
-
86
- For example:
87
- chef-solo -c ~/solo.rb -j ~/node.json -r http://www.example.com/chef-solo.tar.gz
88
-
89
- In the above case, chef-solo would extract the tarball to your specified
90
- cookbook_path, use ~/solo.rb as the configuration file, and apply attributes
91
- and use the run_list from ~/node.json.
92
-
93
- ## SEE ALSO
94
-
95
- Full documentation for Chef and chef-solo is located on the Chef wiki,
96
- http://wiki.opscode.com/display/chef/Home.
97
-
98
- ## AUTHOR
99
-
100
- Chef was written by Adam Jacob <adam@ospcode.com> of Opscode
101
- (http://www.opscode.com), with contributions from the community. This
102
- manual page was written by Joshua Timberman <joshua@opscode.com> with
103
- help2man. Permission is granted to copy, distribute and / or modify
104
- this document under the terms of the Apache 2.0 License.
105
-
106
- On Debian systems, the complete text of the Apache 2.0 License can be
107
- found in /usr/share/common-licenses/Apache-2.0.
@@ -1,89 +0,0 @@
1
- chef-solr(8) -- Runs as Chef's search server
2
- ========================================
3
-
4
- ## SYNOPSIS
5
-
6
- __chef-solr__ _(options)_
7
-
8
- * `-c`, `--config CONFIG`:
9
- The configuration file to use
10
- * `-d`, `--daemonize`:
11
- Daemonize the process
12
- * `-g`, `--group GROUP`:
13
- Group to set privilege to
14
- * `-l`, `--log_level LEVEL`:
15
- Set the log level (debug, info, warn, error, fatal)
16
- * `-L`, `--logfile LOGLOCATION`:
17
- Set the log file location, defaults to STDOUT - recommended for daemonizing
18
- * `-P`, `--pid PIDFILE`:
19
- Set the PID file location, defaults to /tmp/chef-solr.pid
20
- * `-D`, `--solr-data-dir PATH`:
21
- Where the Solr data lives
22
- * `-x`, `--solor-heap-size SIZE`:
23
- Set the size of the Java Heap
24
- * `-H`, `--solr-home-dir PATH`:
25
- Solr home directory
26
- * `-j`, `--java-opts OPTS`:
27
- Raw options passed to Java
28
- * `-x`, `--solor-heap-size`:
29
- Set the size of the Java Heap
30
- * `-W`, `--solr-jetty-dir PATH`:
31
- Where to place the Solr Jetty instance
32
- * `-u`, `--user USER`:
33
- User to set privilege to
34
- * `-v`, `--version`:
35
- Show chef-solr version
36
- * `-h`, `--help`:
37
- Show this message
38
-
39
- ## DESCRIPTION
40
-
41
- Chef-solr provides search service for Chef. You need to have both
42
- chef-solr and chef-expander-cluster running in order for search to work.
43
-
44
- __Installation__
45
-
46
- Make sure you backed up your data if you are upgrading from a previous version.
47
- Run chef-solr-installer to upgrade your Chef Solr installation. Answer "yes"
48
- when prompted for confirmation. The process should look like this:
49
-
50
- yourshell> chef-solr-installer
51
- Configuration setting solr_heap_size is unknown and will be ignored
52
-
53
- Chef Solr is already installed in /var/chef/solr
54
- Do you want to overwrite the current install? All existing Solr data will be lost. [y/n] y
55
- Removing the existing Chef Solr installation
56
- rm -rf /var/chef/solr
57
- rm -rf /var/chef/solr-jetty
58
- rm -rf /var/chef/solr/data
59
- Creating Solr Home Directory
60
- mkdir -p /var/chef/solr
61
- entering /var/chef/solr
62
- tar zxvf /Users/ddeleo/opscode/chef/chef-solr/solr/solr-home.tar.gz
63
- Creating Solr Data Directory
64
- mkdir -p /var/chef/solr/data
65
- Unpacking Solr Jetty
66
- mkdir -p /var/chef/solr-jetty
67
- entering /var/chef/solr-jetty
68
- tar zxvf /Users/ddeleo/opscode/chef/chef-solr/solr/solr-jetty.tar.gz
69
-
70
- Successfully installed Chef Solr.
71
- You can restore your search index using `knife index rebuild`
72
-
73
- ## SEE ALSO
74
-
75
- __chef-expander-cluster__(8)
76
-
77
- Full documentation for Chef and chef-server is located on the Chef
78
- wiki, http://wiki.opscode.com/display/chef/Home.
79
-
80
- ## AUTHOR
81
-
82
- Chef was written by Adam Jacob <adam@ospcode.com> of Opscode
83
- (http://www.opscode.com), with contributions from the community. This
84
- manual page was written by Joshua Timberman <joshua@opscode.com> with
85
- help2man. Permission is granted to copy, distribute and / or modify
86
- this document under the terms of the Apache 2.0 License.
87
-
88
- On Debian systems, the complete text of the Apache 2.0 License can be
89
- found in /usr/share/common-licenses/Apache-2.0.
@@ -1,4 +0,0 @@
1
- LOGFILE=/var/log/chef/client.log
2
- CONFIG=/etc/chef/client.rb
3
- INTERVAL=1800
4
- SPLAY=20
@@ -1,8 +0,0 @@
1
- LOGFILE=/var/log/chef/expander.log
2
- CONFIG=/etc/chef/solr.rb
3
- USER=chef
4
- GROUP=chef
5
- # Sleep to give daemon enough time to fully start or stop.
6
- DIETIME=5
7
- STARTTIME=5
8
- CHEF_EXPANDER_ARGS="-n 1 -i 1"
@@ -1,9 +0,0 @@
1
- LOGFILE=/var/log/chef/server.log
2
- CONFIG=/etc/chef/server.rb
3
- ADAPTER=thin
4
- PORT=4000
5
- USER=chef
6
- GROUP=chef
7
- # Sleep to give daemon enough time to fully start or stop.
8
- STARTTIME=10
9
- DIETIME=5
@@ -1,9 +0,0 @@
1
- LOGFILE=/var/log/chef/server-webui.log
2
- CONFIG=/etc/chef/webui.rb
3
- ADAPTER=thin
4
- PORT=4040
5
- USER=chef
6
- GROUP=chef
7
- # Sleep to give daemon enough time to fully start or stop.
8
- STARTTIME=10
9
- DIETIME=5
@@ -1,8 +0,0 @@
1
- LOGFILE=/var/log/chef/solr.log
2
- CONFIG=/etc/chef/solr.rb
3
- USER=chef
4
- GROUP=chef
5
- # Sleep to give daemon enough time to fully start or stop.
6
- DIETIME=5
7
- STARTTIME=5
8
- MAXTRIES=20
@@ -1,210 +0,0 @@
1
- #! /bin/sh
2
- ### BEGIN INIT INFO
3
- # Provides: chef-client
4
- # Required-Start: $remote_fs $network
5
- # Required-Stop: $remote_fs $network
6
- # Default-Start: 2 3 4 5
7
- # Default-Stop: 0 1 6
8
- # Short-Description: Start a chef-client.
9
- ### END INIT INFO
10
- #
11
- # Copyright (c) 2009-2010 Opscode, Inc, <legal@opscode.com>
12
- #
13
- # chef-client Startup script for chef-client.
14
- # chkconfig: - 99 02
15
- # description: starts up chef-client in daemon mode.
16
-
17
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=$(which chef-client)
19
- NAME=chef-client
20
- DESC=chef-client
21
- PIDFILE=/var/run/chef/client.pid
22
-
23
- test -x $DAEMON || exit 0
24
-
25
- . /lib/lsb/init-functions
26
-
27
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
28
-
29
- if [ ! -d /var/run/chef ]; then
30
- mkdir /var/run/chef
31
- fi
32
-
33
- DAEMON_OPTS="-d -P $PIDFILE -c $CONFIG -i $INTERVAL -s $SPLAY"
34
-
35
- if [ ! -z $LOGFILE ]; then
36
- DAEMON_OPTS="${DAEMON_OPTS} -L $LOGFILE"
37
- fi
38
-
39
- running_pid() {
40
- pid=$1
41
- name=$2
42
- [ -z "$pid" ] && return 1
43
- [ ! -d /proc/$pid ] && return 1
44
- cmd=`awk '/Name:/ {print $2}' /proc/$pid/status`
45
- [ "$cmd" != "$name" ] && return 1
46
- return 0
47
- }
48
-
49
- running() {
50
- [ ! -f "$PIDFILE" ] && return 1
51
- pid=`cat $PIDFILE`
52
- running_pid $pid $NAME || return 1
53
- return 0
54
- }
55
-
56
- start_server() {
57
- if [ -z "$DAEMONUSER" ] ; then
58
- start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
59
- errcode=$?
60
- else
61
- start-stop-daemon --start --quiet --pidfile $PIDFILE \
62
- --chuid $DAEMONUSER \
63
- --exec $DAEMON -- $DAEMON_OPTS
64
- errcode=$?
65
- fi
66
- return $errcode
67
- }
68
-
69
- stop_server() {
70
- if [ -z "$DAEMONUSER" ] ; then
71
- killproc -p $PIDFILE $DAEMON
72
- errcode=$?
73
- else
74
- start-stop-daemon --stop --quiet --pidfile $PIDFILE \
75
- --user $DAEMONUSER \
76
- --exec $DAEMON
77
- errcode=$?
78
- fi
79
- return $errcode
80
- }
81
-
82
- reload_server() {
83
- if [ -z "$DAEMONUSER" ] ; then
84
- killproc -p $PIDFILE $DAEMON -HUP
85
- errcode=$?
86
- else
87
- start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE \
88
- --user $DAEMONUSER \
89
- --exec $DAEMON
90
- errcode=$?
91
- fi
92
- return $errcode
93
- }
94
-
95
- run_server() {
96
- if [ -z "$DAEMONUSER" ] ; then
97
- killproc -p $PIDFILE $DAEMON -USR1
98
- errcode=$?
99
- else
100
- start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE \
101
- --user $DAEMONUSER \
102
- --exec $DAEMON
103
- errcode=$?
104
- fi
105
- return $errcode
106
- }
107
-
108
- force_stop() {
109
- [ ! -e "$PIDFILE" ] && return
110
- if running ; then
111
- /bin/kill -15 $pid
112
- sleep "$DIETIME"s
113
- if running ; then
114
- /bin/kill -9 $pid
115
- sleep "$DIETIME"s
116
- if running ; then
117
- echo "Cannot kill $NAME (pid=$pid)!"
118
- exit 1
119
- fi
120
- fi
121
- fi
122
- rm -f $PIDFILE
123
- }
124
-
125
- case "$1" in
126
- start)
127
- log_daemon_msg "Starting $DESC " "$NAME"
128
- if running ; then
129
- log_progress_msg "apparently already running"
130
- log_end_msg 0
131
- exit 0
132
- fi
133
- if start_server ; then
134
- [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
135
- if running ; then
136
- log_end_msg 0
137
- else
138
- log_end_msg 1
139
- fi
140
- else
141
- log_end_msg 1
142
- fi
143
- ;;
144
- stop)
145
- log_daemon_msg "Stopping $DESC" "$NAME"
146
- if running ; then
147
- errcode=0
148
- stop_server || errcode=$?
149
- log_end_msg $errcode
150
- else
151
- log_progress_msg "apparently not running"
152
- log_end_msg 0
153
- exit 0
154
- fi
155
- ;;
156
- force-stop)
157
- $0 stop
158
- if running; then
159
- log_daemon_msg "Stopping (force) $DESC" "$NAME"
160
- errcode=0
161
- force_stop || errcode=$?
162
- log_end_msg $errcode
163
- fi
164
- ;;
165
- restart|force-reload)
166
- log_daemon_msg "Restarting $DESC" "$NAME"
167
- errcode=0
168
- stop_server || errcode=$?
169
- [ -n "$DIETIME" ] && sleep $DIETIME
170
- start_server || errcode=$?
171
- [ -n "$STARTTIME" ] && sleep $STARTTIME
172
- running || errcode=$?
173
- log_end_msg $errcode
174
- ;;
175
- status)
176
- log_daemon_msg "Checking status of $DESC" "$NAME"
177
- if running ; then
178
- log_progress_msg "running"
179
- log_end_msg 0
180
- else
181
- log_progress_msg "apparently not running"
182
- log_end_msg 1
183
- exit 3
184
- fi
185
- ;;
186
- reload)
187
- if running; then
188
- log_daemon_msg "Reloading $DESC" "$NAME"
189
- errcode=0
190
- reload_server || errcode=$?
191
- log_end_msg $errcode
192
- fi
193
- ;;
194
- run)
195
- if running; then
196
- log_daemon_msg "Triggering run of $DESC" "$NAME"
197
- errcode=0
198
- run_server || errcode=$?
199
- log_end_msg $errcode
200
- fi
201
- ;;
202
- *)
203
- N=/etc/init.d/$NAME
204
- echo "Usage: $N {start|stop|force-stop|restart|force-reload|status|run}" >&2
205
- exit 1
206
- ;;
207
- esac
208
-
209
- exit 0
210
-