Sometimes, we need the server to control the remote server to do some things, while stable and reliable, will not suddenly hang out or anything.
Then Ruby is a great tool.
# encoding:utf-8#!/usr/bin/ruby# encoding:utf-8# Port 1990# Browser access: Http://127.0.0.1:1990/hello/passwordrequire ' Sinatra /base ' require ' json ' require ' net/http ' class Hello < Sinatra::base set:p ort, 1990 Set:bind, ' 0.0.0.0 ' set:environm ENT,:p roduction get '/hello/:p wd ' Do {result:1, message: ' Hello '}.to_json End class << self DEF init p UTS ' init ' end end init run!end
Based on the very well-known Sinatra web framework, a very nice mini-frame, just a few lines of code to implement a Web program, which is used to run remote scripting, stable and reliable. Of course, you can also use your own webbrick, but the code doesn't look comfortable.
Ruby Run.rb ran up.
Ruby Remote Control script