Skip to content

Instantly share code, notes, and snippets.

@pyk
Created February 1, 2014 01:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyk/8746519 to your computer and use it in GitHub Desktop.
Save pyk/8746519 to your computer and use it in GitHub Desktop.
def self.run
# set current working directory
file_path = File.expand_path(__FILE__) # File.join(Dir.getwd, __FILE__))
file_workdir = File.dirname( file_path )
file_logdir = File.join(file_workdir, 'log')
Dir.chdir file_workdir
@@cwd = Dir.getwd
@@name = File.basename($0)
@@hostname = Socket.gethostname
@@dir = file_workdir
APP_INFO << " on #{@@hostname}"
if configure then
show_version
stopped = if ['stop','restart'].include?(@@cmd) then
command_stop
end
if ['run','start','restart'].include?(@@cmd) && stopped != false then
@@cmd = 'start' if @@cmd == 'restart'
command_start
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment