Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
= Daemons Version 1.1.10
(See Releases for release-specific information)
== What is Daemons?
Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands.
If you want, you can also use daemons to run blocks of ruby code in a daemon process and to control these processes from the main application.
Besides this basic functionality, daemons offers many advanced features like exception backtracing and logging (in case your ruby script crashes) and monitoring and automatic restarting of your processes if they crash.
== Basic Usage
You can use Daemons in four different ways:
=== 1. Create wrapper scripts for your server scripts or applications
Layout: suppose you have your self-written server myserver.rb:
loop do sleep(5) end
To use myserver.rb in a production environment, you need to be able to run myserver.rb in the background (this means detach it from the console, fork it in the background, release all directories and file descriptors).
Just create myserver_control.rb like this:
require 'rubygems' # if you use RubyGems require 'daemons'
Daemons.run('myserver.rb')
And use it like this from the console:
$ ruby myserver_control.rb start (myserver.rb is now running in the background) $ ruby myserver_control.rb restart (...) $ ruby myserver_control.rb stop
For testing purposes you can even run myserver.rb without forking in the background:
$ ruby myserver_control.rb run
An additional nice feature of Daemons is that you can pass additional arguments to the script that should be daemonized by seperating them by two hyphens:
$ ruby myserver_control.rb start -- --file=anyfile --a_switch another_argument
=== 2. Create wrapper scripts that include your server procs
Layout: suppose you have some code you want to run in the background and control that background process from a script:
loop do sleep(5) end
To run this code as a daemon create myproc_control.rb like this and include your code:
require 'rubygems' # if you use RubyGems require 'daemons'
Daemons.run_proc('myproc.rb') do loop do sleep(5) end end
And use it like this from the console:
$ ruby myproc_control.rb start (myproc.rb is now running in the background) $ ruby myproc_control.rb restart (...) $ ruby myproc_control.rb stop
For testing purposes you can even run myproc.rb without forking in the background:
$ ruby myproc_control.rb run
=== 3. Control a bunch of daemons from another application
Layout: you have an application my_app.rb that wants to run a bunch of server tasks as daemon processes.
require 'rubygems' # if you use RubyGems require 'daemons'
task1 = Daemons.call(:multiple => true) do # first server task
loop {
conn = accept_conn()
serve(conn)
}
end
task2 = Daemons.call do # second server task
loop {
something_different()
}
end
task1.stop task2.stop
exit
=== 4. Daemonize the currently running process
Layout: you have an application my_daemon.rb that wants to run as a daemon (but without the ability to be controlled by daemons via start/stop commands)
require 'rubygems' # if you use RubyGems require 'daemons'
init()
Daemons.daemonize
loop { conn = accept_conn() serve(conn) }
For further documentation, refer to the module documentation of Daemons.
== Download and Installation
Download: just go to http://rubyforge.org/projects/daemons/
Installation with RubyGems: $ su
Installation without RubyGems: $ tar xfz daemons-x.x.x.tar.gz $ cd daemons-x.x.x $ su
== Documentation
For further documentation, refer to the module documentation of Daemons (click on Daemons).
The RDoc documentation is also online at http://daemons.rubyforge.org
== Author
Written 2005-2013 by Thomas Uehlinger mailto:th.uehlinger@gmx.ch. Anonymous SVN checkout is available with "svn checkout http://daemons.rubyforge.org/svn/".
== License
Copyright (c) 2005-2013 Thomas Uehlinger
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
== Feedback and other resources
FAQs
Unknown package
We found that blue-daemons demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.