Daemonizing JRuby with Akuma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'java' | |
require 'akuma-1.7.jar' | |
require 'jna-3.4.0.jar' | |
java_import 'com.sun.akuma.Daemon' | |
d = com::sun::akuma::Daemon.new | |
if d.daemonized? | |
puts "Daemonizing with PID #{$$}" | |
d.init | |
else | |
d.daemonize | |
exit | |
end | |
sleep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download akuma-1.7.jar and jna-3.4.0.jar from the following sites: | |
・http://mvnrepository.com/artifact/org.kohsuke/akuma/1.8 | |
・http://mvnrepository.com/artifact/net.java.dev.jna/jna/3.4.0 | |
$ ls | |
akuma-1.7.jar akuma.rb jna-3.4.0.jar | |
$ jruby akuma.rb | |
Daemonizing with PID 16811 | |
$ jps -vv | |
16811 Main -Dcom.sun.akuma.Daemon=daemonized -Dfile.encoding=UTF-8 -Djdk.home= -Djruby.home=/Users/nicksieger/Projects/ruby/jruby -Djruby.script=jruby -Djruby.shell=/bin/sh -Djffi.boot.library.path=/Users/nicksieger/Projects/ruby/jruby/lib/native/Darwin -Xmx500m -Xss2048k -Djruby.memory.max=500m -Djruby.stack.max=2048k -Xbootclasspath/a:/Users/nicksieger/Projects/ruby/jruby/lib/jruby.jar | |
16948 Jps -Dapplication.home=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -Xms8m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment