Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| var child_process = require('child_process'); | |
| exports.handler = function(event, context) { | |
| var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' }); | |
| proc.on('close', function(code){ | |
| if(code !== 0) { | |
| return context.done(new Error("Process exited with non-zero status code")); | |
| } |
| #!/bin/bash | |
| # CONF | |
| DBG=true | |
| [email protected] | |
| RELOG_PASSW=xxxxxxxxxxxxxxx | |
| # END CONF |
| # put the cookbook path in solo.rb file. | |
| echo 'cookbook_path ["/opt/aws/opsworks/current/site-cookbooks"]' > solo.rb | |
| # create json file incase if you want use the attributes from opsworks. | |
| opsworks-agent-cli get_json > attributes.json | |
| #run chef-solo | |
| /opt/aws/opsworks/current/bin/chef-solo -c solo.rb -o cookbook_name::default -j attributes.json |
Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)