dctl 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +5 -0
- data/README +23 -14
- data/Rakefile +2 -2
- data/TODO +2 -2
- data/lib/dctl/daemon.rb +3 -0
- data/lib/dctl/metainf.rb +1 -1
- data/test/daemon_test.rb +3 -4
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
*1.0.1* (08th April, 2005) Bruno Carnazzi <mailto:bcarnazzi@gmail.com>
|
2
|
+
* updated Rakefile (and included gemspec)
|
3
|
+
* added a check on daemon for valid app_path (daemon_test.rb updated)
|
4
|
+
* updated documentation
|
5
|
+
|
1
6
|
*1.0.0* (07th April, 2005) Bruno Carnazzi <mailto:bcarnazzi@gmail.com>
|
2
7
|
* Full rewrite from scratch
|
3
8
|
* Multiple daemon instances does not exists anymore
|
data/README
CHANGED
@@ -4,7 +4,7 @@ dctl is a small script for providing daemon functionnalty (start, stop, ...)
|
|
4
4
|
to non-daemon process or script, with automatic handling of pidfiles.
|
5
5
|
dctl is mainly an extended rewrite of the daemons[http://rubyforge.org/projects/daemons/]
|
6
6
|
project for learning purpose.
|
7
|
-
It is designed to be small and smart
|
7
|
+
It is designed to be small and smart ("less-is-more" philosophy), generic, and well-tested.
|
8
8
|
|
9
9
|
Major features:
|
10
10
|
* Convert any executable file with endless lifecycle into a controllable daemon
|
@@ -14,7 +14,7 @@ Major features:
|
|
14
14
|
|
15
15
|
== Examples
|
16
16
|
|
17
|
-
=== Start a daemon with redirection of stdout
|
17
|
+
=== Start a daemon with redirection of stdout in file 'out'
|
18
18
|
% dctl start -oout test/infinite.sh
|
19
19
|
|
20
20
|
=== Get the status of a daemon
|
@@ -32,27 +32,35 @@ The latest version of dctl can be found at :
|
|
32
32
|
|
33
33
|
== Installation
|
34
34
|
|
35
|
-
|
36
|
-
As dctl stands on cmdparser, you need to have cmdparser installed before.
|
37
|
-
I plan to make a GEM for dctl soon.
|
35
|
+
As dctl stands on cmdparse[http://rubyforge.org/projects/cmdparse/], you need to have cmdparse[http://rubyforge.org/projects/cmdparse/] installed before.
|
38
36
|
|
39
|
-
|
40
|
-
|
37
|
+
Installation *with* RubyGems:
|
38
|
+
$ su
|
39
|
+
# gem install dctl
|
40
|
+
|
41
|
+
Installation *without* RubyGems:
|
42
|
+
$ tar xfz dctl-x.x.x.tar.gz
|
43
|
+
$ cd dctl-x.x.x
|
44
|
+
$ su
|
45
|
+
# ruby setup.rb
|
41
46
|
|
42
|
-
=== Notes
|
43
|
-
If you installed cmdparser as a gem, please check your RUBYOPTS which should looks like:
|
44
|
-
% echo $RUBYOPTS
|
45
|
-
-rubygems
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
== Notes
|
49
|
+
|
50
|
+
Please note that dctl test suite only succeeds if launched by a non-root user !
|
51
|
+
|
52
|
+
|
53
|
+
== Future
|
54
|
+
|
55
|
+
I'm thinking about dctl as a system service manager...
|
49
56
|
|
50
57
|
|
51
58
|
== Author
|
52
59
|
|
53
60
|
Written in 2005 by Bruno Carnazzi <mailto:bcarnazzi@gmail.com>
|
54
61
|
|
55
|
-
|
62
|
+
|
63
|
+
== License and copyright
|
56
64
|
|
57
65
|
dctl is free software. You can redistribute it under the terms specified in
|
58
66
|
the COPYING file of the Ruby distribution.
|
@@ -61,3 +69,4 @@ the COPYING file of the Ruby distribution.
|
|
61
69
|
== Feedback and other resources
|
62
70
|
|
63
71
|
At http://rubyforge.org/projects/dctl/
|
72
|
+
|
data/Rakefile
CHANGED
@@ -59,7 +59,7 @@ spec = Gem::Specification.new do |s|
|
|
59
59
|
|
60
60
|
s.files = [ "Rakefile", "setup.rb", "README", "TODO", "CHANGELOG" ]
|
61
61
|
dist_dirs.each do |dir|
|
62
|
-
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?(
|
62
|
+
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?("\.svn") or item.include?("CVS") }
|
63
63
|
end
|
64
64
|
s.executables = ['dctl']
|
65
65
|
s.bindir = 'bin'
|
@@ -77,7 +77,7 @@ spec = Gem::Specification.new do |s|
|
|
77
77
|
|
78
78
|
s.author = "Bruno Carnazzi"
|
79
79
|
s.email = "bcarnazzi@gmail.com"
|
80
|
-
s.homepage = "http://rubyforge.org/
|
80
|
+
s.homepage = "http://rubyforge.org/projects/dctl/"
|
81
81
|
s.rubyforge_project = "dctl"
|
82
82
|
end
|
83
83
|
|
data/TODO
CHANGED
data/lib/dctl/daemon.rb
CHANGED
@@ -10,6 +10,9 @@ module Dctl
|
|
10
10
|
def initialize(cmd, pidpath)
|
11
11
|
@app_path = Daemon::which cmd
|
12
12
|
@app_path = File.expand_path cmd if not @app_path
|
13
|
+
raise Errno::EISDIR, @app_path if File.directory? @app_path
|
14
|
+
raise Errno::ENOENT, @app_path until File.file? @app_path
|
15
|
+
raise Errno::EACCES, @app_path until File.executable? @app_path
|
13
16
|
@pidfile = PidFile.new pidpath, File.basename(cmd)
|
14
17
|
end
|
15
18
|
|
data/lib/dctl/metainf.rb
CHANGED
data/test/daemon_test.rb
CHANGED
@@ -20,20 +20,19 @@ class DaemonTest < Test::Unit::TestCase
|
|
20
20
|
|
21
21
|
def test_run
|
22
22
|
assert_raise(Errno::ENOENT) { Dctl::Daemon.new('idontexist', '.').run }
|
23
|
-
assert_raise(Errno::
|
23
|
+
assert_raise(Errno::EISDIR) { Dctl::Daemon.new('/bin', '.').run }
|
24
24
|
assert_raise(Errno::EACCES) { Dctl::Daemon.new('/etc/passwd', '.').run }
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_stop
|
28
|
-
fork { Dctl::Daemon.new('test/infinite.sh', '.').start }
|
29
|
-
sleep 1
|
28
|
+
fork { Dctl::Daemon.new('test/infinite.sh', '.').start } and sleep 1
|
30
29
|
assert_nothing_thrown { Dctl::Daemon.new('test/infinite.sh', '.').stop }
|
31
30
|
assert Dir['*.pid'].empty?
|
32
31
|
assert_raise(Errno::ENOENT) { Dctl::Daemon.new('test/infinite.sh', '.').stop }
|
33
32
|
end
|
34
33
|
|
35
34
|
def test_concurrent
|
36
|
-
puts '1' ; fork { Dctl::Daemon.new('test/infinite.sh', '.').start }
|
35
|
+
puts '1' ; fork { Dctl::Daemon.new('test/infinite.sh', '.').start } and sleep 1
|
37
36
|
puts '2' ; assert_raise(Errno::EEXIST) { Dctl::Daemon.new('test/infinite.sh', '.').run }
|
38
37
|
puts '3' ; assert_nothing_thrown { Dctl::Daemon.new('test/infinite.sh', '.').stop }
|
39
38
|
assert Dir['*.pid'].empty?
|
metadata
CHANGED
@@ -3,13 +3,13 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: dctl
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2005-04-
|
6
|
+
version: 1.0.1
|
7
|
+
date: 2005-04-08
|
8
8
|
summary: "dctl - a daemon controller written in Ruby"
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: bcarnazzi@gmail.com
|
12
|
-
homepage: http://rubyforge.org/
|
12
|
+
homepage: http://rubyforge.org/projects/dctl/
|
13
13
|
rubyforge_project: dctl
|
14
14
|
description: "dctl is a small script for providing daemon functionnalty (start, stop, ...) to
|
15
15
|
non-daemon process or script, with automatic handling of pidfiles."
|