Managing daemon using daemon-kit

Hey all, In Previous article i have given short bio of ruby daemon using daemon kit. In this post i am writing about how to manage daemon,how to start/stop a daemon from any directory. We can start a daemon using following way. Go to the directory and give the command. or (You know the difference right; To run it in foreground or background respectively.) But consider this possibility, what if you didn’t want to go to the directory where the

Continue Reading

Understanding Daemonkit

Hey all, Many of us knows what daemons are in linux. These are processes or programs that run in background with little or no user intervention. Now we can write daemons in ruby too. And for doing so we can use Daemon-Kit(https://github.com/kennethkalmer/daemon-kit). Now the daemon can do the task continuously or do it at particular interval of time or do it depending on a particular event. Daemon-Kit provides a skeleton to write these different types of daemons with the help

Continue Reading

Passing arrays using Net-http in Ruby

Hi all, We needed to use net/http of ruby for sending parameters between two modules. We decided to use the get and the post request of http as follows: url = URI.parse(“http://SERVER:PORT”) http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(“/method_name?parameter=a”) response = http.request(request) In the above get request the parameter “a” is taken to the “http://SERVER:PORT/method_name” and data related to it is queried. url = URI.parse(“http://SERVER:PORT”) http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(“/method_name”) request.set_form_data({“parameter1” => “a”, “parameter2” => “b”, “parameter3” =>

Continue Reading

Word Search Using grep and AWK

In one of our project we needed to search for multiple words from a file and return the found words. These files would be large and there might be large number of words to search for also. Ruby has a good support for regexp, however it would be slow in doing these searches for patterns as compared to unix commands and hence we decided to look for certain unix commands for doing these searches. We went through “grep“, “awk” and

Continue Reading

Mount Remote File System Using Fuse and sshfs

In one of the project we needed to store data in our data center i.e not place(store) it on cloud specifically. And this data needs to be available to multiple users/system. The operation on this data included creating/editing a file, copying a file from those stored data or copying to it. After searching a few, we decided to use Fuse along with sshfs. Fuse allows to use a  remote file as a local file and allows us to make changes

Continue Reading

Site Footer