OpsScript
Module to provide basic functionality common to many operations scripts. Specifically:
- Create and manage log file
- Use PID file to insure only one instance runs at a time
- Provide basic command line options such as --debug to log debug messages
Installation
Add this line to your application's Gemfile:
gem 'ops_script'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ops_script
Usage
require 'ops_script'
include OpsScript
# Add custom options
option_parser.on "--bar", "The bar option" do
[:bar] = true
end
# Run your code
OpsScript.run do
log.info "This is my script running!"
# your code here
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request