避免ruby脚本重复运行的函数
git clone git://github.com/weidewang/run_once.git cd run_once rake install
#!/usr/bin/env ruby
require 'rubygems'
require 'run_once'
# RunOnce.runing(:pid_dir => Dir::tmpdir,:file_name => $0)
#
RunOnce.runing{|pid|
puts %Q~#{$0} is runing,pid is #{pid}~
exit(0)
}
# you code
exit(0)
- 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