[#392128] negative grep — Matt Lawrence <matt@...>

A bit of syntax that I have never picked up. How do I use grep to exclude

14 messages 2012/01/12
[#392129] Re: negative grep — K Clair <kclair@...> 2012/01/12

biglist !~ /bar/

[#392135] Problem with "Exception" - suddenly stopped working — Panagiotis Atmatzidis <ml@...>

Hello,

16 messages 2012/01/12
[#392144] Re: Problem with "Exception" - suddenly stopped working — "Abinoam Jr." <abinoam@...> 2012/01/12

IMHO ~PERHAPS~ the begin rescue is not working because the exception

[#392146] Re: Problem with "Exception" - suddenly stopped working — Peter Vandenabeele <peter@...> 2012/01/12

On Thu, Jan 12, 2012 at 10:04 PM, Abinoam Jr. <abinoam@gmail.com> wrote:

[#392147] Re: Problem with "Exception" - suddenly stopped working — Peter Vandenabeele <peter@...> 2012/01/12

On Thu, Jan 12, 2012 at 10:33 PM, Peter Vandenabeele <peter@vandenabeele.com

[#392154] Re: Problem with "Exception" - suddenly stopped working — Panagiotis Atmatzidis <ml@...> 2012/01/12

Hello,

[#392161] Re: Problem with "Exception" - suddenly stopped working — "Abinoam Jr." <abinoam@...> 2012/01/13

On Thu, Jan 12, 2012 at 8:45 PM, Panagiotis Atmatzidis

[#392162] Re: Problem with "Exception" - suddenly stopped working — Peter Vandenabeele <peter@...> 2012/01/13

On Fri, Jan 13, 2012 at 12:23 PM, Abinoam Jr. <abinoam@gmail.com> wrote:

[#392242] The Better Code — Intransition <transfire@...>

Which would you judge to be the better code?

15 messages 2012/01/16

[#392252] Which library to write a parser — thomas carlier <carlier.thomas@...>

Hi,

16 messages 2012/01/16

[#392262] uniq with count; better way? — Ralph Shnelvar <ralphs@...32.com>

a = [4,5,6,4,5,6,6,7]

42 messages 2012/01/16
[#392266] Re: uniq with count; better way? — Sigurd <cu9ypd@...> 2012/01/16

The first that came to my mind.

[#392268] Re: uniq with count; better way? — Adam Prescott <adam@...> 2012/01/16

On Mon, Jan 16, 2012 at 16:00, Sigurd <cu9ypd@gmail.com> wrote:

[#392277] Re: uniq with count; better way? — Magnus Holm <judofyr@...> 2012/01/16

On Mon, Jan 16, 2012 at 17:04, Adam Prescott <adam@aprescott.com> wrote:

[#392287] Re: uniq with count; better way? — "Abinoam Jr." <abinoam@...> 2012/01/17

On Mon, Jan 16, 2012 at 1:48 PM, Magnus Holm <judofyr@gmail.com> wrote:

[#392289] Re: uniq with count; better way? — "Abinoam Jr." <abinoam@...> 2012/01/17

On Mon, Jan 16, 2012 at 9:22 PM, Abinoam Jr. <abinoam@gmail.com> wrote:

[#392291] Re: uniq with count; better way? — "Abinoam Jr." <abinoam@...> 2012/01/17

On Mon, Jan 16, 2012 at 10:05 PM, Abinoam Jr. <abinoam@gmail.com> wrote:

[#392303] Re: uniq with count; better way? — Peter Vandenabeele <peter@...> 2012/01/17

On Tue, Jan 17, 2012 at 2:44 AM, Abinoam Jr. <abinoam@gmail.com> wrote:

[#392351] Re: uniq with count; better way? — Robert Klemme <shortcutter@...> 2012/01/18

On Tue, Jan 17, 2012 at 12:08 PM, Peter Vandenabeele

[#392286] Parsing log with date time entry — Christopher Graves <gravescl@...>

The log file looks like this

24 messages 2012/01/16

[#392406] Name directory with a variable — Alex Sweps <alexszepes@...>

Hello again everyone.

14 messages 2012/01/20

[#392429] Getting an Object to Push or Register "Itself" With a Hash During Initialization — Frank Guerino <frank.guerino@...4it.com>

Hi,

11 messages 2012/01/20

[#392460] Microrant on Ruy's Math Skills — Intransition <transfire@...>

So simple...

116 messages 2012/01/21
[#392464] Re: Microrant on Ruy's Math Skills — Gary Wright <gwtmp01@...> 2012/01/21

[#392469] Re: Microrant on Ruy's Math Skills — Yossef Mendelssohn <ymendel@...> 2012/01/21

On Jan 21, 2012 9:34 AM, "Gary Wright" <gwtmp01@mac.com> wrote:

[#392471] Re: Microrant on Ruy's Math Skills — Su Zhang <su.comp.lang.ruby@...> 2012/01/21

On 1/21/2012 12:08 PM, Yossef Mendelssohn wrote:

[#392499] Re: Microrant on Ruy's Math Skills — Intransition <transfire@...> 2012/01/22

So they can drop a billion transistors on a chip, have implemented 3D

[#392547] Re: Microrant on Ruy's Math Skills — Robert Klemme <shortcutter@...> 2012/01/23

On Sun, Jan 22, 2012 at 3:03 AM, Intransition <transfire@gmail.com> wrote:

[#392550] Re: Microrant on Ruy's Math Skills — Peter Vandenabeele <peter@...> 2012/01/23

On Mon, Jan 23, 2012 at 9:29 AM, Robert Klemme

[#392579] Re: Microrant on Ruy's Math Skills — Chad Perrin <code@...> 2012/01/23

On Mon, Jan 23, 2012 at 07:33:20PM +0900, Peter Vandenabeele wrote:

[#392581] Re: Microrant on Ruy's Math Skills — Steve Klabnik <steve@...> 2012/01/23

> Even that and the '1.1'.to_dec option mentioned elsewhere seem pretty

[#392585] Re: Microrant on Ruy's Math Skills — Chad Perrin <code@...> 2012/01/23

On Tue, Jan 24, 2012 at 03:14:27AM +0900, Steve Klabnik wrote:

[#392587] Re: Microrant on Ruy's Math Skills — Steve Klabnik <steve@...> 2012/01/23

No, it's not a terminology difference. That's why it won't work. You

[#392590] Re: Microrant on Ruy's Math Skills — Chad Perrin <code@...> 2012/01/23

On Tue, Jan 24, 2012 at 05:45:18AM +0900, Steve Klabnik wrote:

[#392591] Re: Microrant on Ruy's Math Skills — Ryan Davis <ryand-ruby@...> 2012/01/23

[#392618] Re: Microrant on Ruy's Math Skills — Alex Chaffee <alexch@...> 2012/01/24

"Standard is better than better." -Anon.

[#392643] Re: Microrant on Ruy's Math Skills — Gavin Sinclair <gsinclair@...> 2012/01/25

On Wed, Jan 25, 2012 at 6:05 AM, Alex Chaffee <alexch@gmail.com> wrote:

[#392673] Re: Microrant on Ruy's Math Skills — Intransition <transfire@...> 2012/01/25

I have tried this, but recently discovered the same issues arise.

[#392743] Re: Microrant on Ruy's Math Skills — Garthy D <garthy_lmkltybr@...> 2012/01/27

[#392745] Re: Microrant on Ruy's Math Skills — Josh Cheek <josh.cheek@...> 2012/01/27

On Thu, Jan 26, 2012 at 6:05 PM, Garthy D <

[#392766] Re: Microrant on Ruy's Math Skills — Adam Prescott <adam@...> 2012/01/27

On Fri, Jan 27, 2012 at 03:05, Josh Cheek <josh.cheek@gmail.com> wrote:

[#392776] Re: Microrant on Ruy's Math Skills — Chad Perrin <code@...> 2012/01/27

On Fri, Jan 27, 2012 at 11:02:52PM +0900, Adam Prescott wrote:

[#392781] Re: Microrant on Ruy's Math Skills — Gary Wright <gwtmp01@...> 2012/01/27

[#392805] Re: Microrant on Ruy's Math Skills — "Jon Lambert" <jlambert@...> 2012/01/29

On Jan 27, 2012, at 3:26 PM, Gary Wright wrote:

[#392831] Re: Microrant on Ruy's Math Skills — Gary Wright <gwtmp01@...> 2012/01/30

[#392835] Re: Microrant on Ruy's Math Skills — Chad Perrin <code@...> 2012/01/30

On Mon, Jan 30, 2012 at 10:03:04AM +0900, Gary Wright wrote:

[#392837] Re: Microrant on Ruy's Math Skills — Robert Klemme <shortcutter@...> 2012/01/30

On Mon, Jan 30, 2012 at 6:56 AM, Chad Perrin <code@apotheon.net> wrote:

[#392847] Re: Microrant on Ruy's Math Skills — Chad Perrin <code@...> 2012/01/30

On Mon, Jan 30, 2012 at 05:22:47PM +0900, Robert Klemme wrote:

[#392511] Building desktop application using Ruby and any GUI Framework — Rubyist Rohit <passionate_programmer@...>

I want to write a small desktop application on Ruby. I want the

12 messages 2012/01/22

[#392598] Web Application from Scratch - like PHP — "Gaurav C." <chande.gaurav@...>

Hi,

17 messages 2012/01/24

[#392635] A little assistance please :) — Paet Worlds II <paetilium@...>

So I'm still quite new to Ruby and so far I love it's simplicity, but I

21 messages 2012/01/25
[#392636] Re: A little assistance please :) — Hilco Wijbenga <hilco.wijbenga@...> 2012/01/25

On 24 January 2012 17:14, Paet Worlds II <paetilium@live.com> wrote:

[#392637] Re: A little assistance please :) — Paet Worlds II <paetilium@...> 2012/01/25

Hilco Wijbenga wrote in post #1042399:

[#392641] Re: A little assistance please :) — Chad Perrin <code@...> 2012/01/25

On Wed, Jan 25, 2012 at 10:41:10AM +0900, Paet Worlds II wrote:

[#392672] Re: A little assistance please :) — Dave Aronson <rubytalk2dave@...> 2012/01/25

On Tue, Jan 24, 2012 at 23:32, Chad Perrin <code@apotheon.net> wrote:

[#392711] Re: A little assistance please :) — Chad Perrin <code@...> 2012/01/26

On Thu, Jan 26, 2012 at 03:43:59AM +0900, Dave Aronson wrote:

[#392818] Help please Undefined Method error — "andres d." <andres.1996.1@...>

Hi and thank you for reading this

12 messages 2012/01/29

[#392867] Multiple assignment in conditional — Gavin Sinclair <gsinclair@...>

I find this a strange Ruby error.

28 messages 2012/01/31
[#392868] Re: Multiple assignment in conditional — Josh Cheek <josh.cheek@...> 2012/01/31

On Tue, Jan 31, 2012 at 12:46 AM, Gavin Sinclair <gsinclair@gmail.com>wrote:

[#392944] Re: Multiple assignment in conditional — Gavin Sinclair <gsinclair@...> 2012/02/01

On Tue, Jan 31, 2012 at 6:22 PM, Josh Cheek <josh.cheek@gmail.com> wrote:

[#392914] Re: Multiple assignment in conditional — Robert Klemme <shortcutter@...> 2012/01/31

On Tue, Jan 31, 2012 at 7:46 AM, Gavin Sinclair <gsinclair@gmail.com> wrote=

[#392917] PHP vs Ruby is it worth it? — Samuel Mensah <sasogeek@...>

Hi, I've been searching around for what the best language there is out

14 messages 2012/01/31

Re: Servolux: monitoring outside change?

From: Tim Pease <tim.pease@...>
Date: 2012-01-11 18:00:01 UTC
List: ruby-talk #392117
On Jan 11, 2012, at 9:51 AM, Aldric Giacomoni wrote:

> Daemons seemed to fit the bill: long-running process in the =
background.
>=20
> Sadly, I ran into an issue in my unit tests where the Daemon would =
actually
> run so fast that Ruby would miss the start of it. Since that's not =
going to
> happen in my configuration in real life, I just made the script run a
> little longer.
>=20
> Now, here is my current situation. Upon completion of a test where the
> Daemon.new.startup is called, the entire test suite stops running. The
> script runs properly. My unit test checks that upon completion, the =
script
> has done what it needs to do, so imagine this:
>=20
> def test_launches_outside_process
>  at_exit { assert_equal 100, Dir['/tmp/*'] }
>  Manager.new.launch {some =3D> args, here =3D> to, help =3D> out}
> end
>=20
> Now, the launch command:
> class Manager
>  def launch args
>    daemon =3D Servolux::Daemon.new :startup_command =3D> "/path/to/cmd =
with
> args", :name =3D> "name", :pid_file =3D> "/tmp/pid", :logger =3D>
> Logger.new('/tmp/log.log')
>    daemon.startup
>    at_exit { daemon.shutdown }
>   daemon
>  end
> end
>=20
> =46rom what I understand of the implementation, the daemon process, =
calling
> Kernel.exec, actually REPLACES the Ruby process. I realize it's =
supposed to
> fork up in the startup method, but ... How, then, can I use one single =
Ruby
> process to launch many daemons?
>=20
> I wrote a small script to identify my problem (maybe I'm thinking =
about it
> incorrectly):
> #!/usr/bin/env ruby
>=20
> require 'rubygems'
> require 'servolux'
> require 'logger'
>=20
> x =3D Servolux::Daemon.new :name =3D> 'hello', :logger =3D>
> Logger.new('/tmp/aldric.log'), :startup_command =3D> 'sleep 600', =
:pid_file
> =3D> '/tmp/aldric.pid'
> x.startup
> p "hello" while true
>=20
> This script does NOT print 'hello'. It returns to the command line and
> sleep is now running in the background.
>=20
> So.. If the Daemon object is really only meant to configure and start =
a
> daemon, then I -do- want a Child object, don't I.
> Thanks for the answer. The problem I have with calling 'wait' on the =
Child
> object is that I block my top-level process until I get more =
information
> from that child. I'm going to be in a situation where I have 20+ =
children
> all running. How can I monitor them all? Can I call Process.waitall =
and get
> the same result?
>=20

When you start the daemon, pass +false+ to the startup method. This will =
prevent exiting from the parent process after the daemon process is =
determined to be running.

http://rubydoc.info/gems/servolux/0.9.6/Servolux/Daemon:startup

Blessings,
TwP

> On Wed, Jan 11, 2012 at 11:10, Aldric Giacomoni <trevoke@gmail.com> =
wrote:
>=20
>> Oh, I see. What I want to use here is a daemon, not a child.
>>=20
>>=20
>> On Tue, Jan 10, 2012 at 23:07, Aldric Giacomoni <trevoke@gmail.com> =
wrote:
>>=20
>>> Thanks for the answer. I decided to try that behavior, and here is =
the
>>> result (sadly, negative). I must be doing something wrong... But =
what?
>>> Ruby 1.8.7-p357:
>>> $ pry
>>> [1] pry(main)> require 'servolux'
>>> =3D> true
>>> [2] pry(main)> x =3D Servolux::Child.new :command =3D> "sleep 600"
>>> =3D> #<Servolux::Child:0xb7024290
>>> @command=3D"sleep 600",  @io=3Dnil, @pid=3Dnil,
>>> @signals=3D["TERM", "QUIT", "KILL"], @status=3Dnil,
>>> @suspend=3D4, @thread=3Dnil, @timed_out=3Dnil, @timeout=3Dnil>
>>> [3] pry(main)> x.start
>>> =3D> #<IO:0xb701c6bc>
>>> [4] pry(main)> x.pid
>>> =3D> 17152
>>>=20
>>> (at this point, I do a $ kill -9 17152 in another terminal)
>>>=20
>>> [5] pry(main)> x.signaled?
>>> =3D> nil
>>> [6] pry(main)> x.termsig
>>> =3D> nil
>>>=20
>>> Same test with Ruby 1.9.2-p290:
>>>=20
>>> $ pry
>>> [1] pry(main)> RUBY_VERSION
>>> =3D> "1.9.2"
>>> [2] pry(main)> require 'servolux'
>>> =3D> true
>>> [3] pry(main)> x =3D Servolux::Child.new :command =3D> "sleep 600"
>>> =3D> #<Servolux::Child:0x84d68c4
>>> @command=3D"sleep 600",
>>> @io=3Dnil,
>>> @pid=3Dnil,
>>> @signals=3D["TERM", "QUIT", "KILL"],
>>> @status=3Dnil,
>>> @suspend=3D4,
>>> @thread=3Dnil,
>>> @timed_out=3Dnil,
>>> @timeout=3Dnil>
>>> [4] pry(main)> x.start
>>> =3D> #<IO:fd 3>
>>> [5] pry(main)> x.pid
>>> =3D> 17614
>>>=20
>>> (again, kill -9 17614 in another terminal)
>>>=20
>>> [9] pry(main)> x.signaled?
>>> =3D> nil
>>> [10] pry(main)> x.termsig
>>> =3D> nil
>>>=20
>>> In both situations, doing a 'ps eax | grep sleep' revealed the =
following:
>>> 17614 pts/5    ZN+    0:00 [sleep] <defunct>
>>>=20
>>> Exiting the irb/pry session lets the sleep process finally die a =
peaceful
>>> death.
>>>=20
>>> Would this count as a bug in Servolux?
>>>=20
>>> --Aldric
>>>=20
>>> On Tue, Jan 10, 2012 at 21:44, Tim Pease <tim.pease@gmail.com> =
wrote:
>>>=20
>>>>=20
>>>> On Jan 10, 2012, at 1:05 PM, Aldric Giacomoni wrote:
>>>>=20
>>>>> Hi Tim,
>>>>>=20
>>>>> I started using Servolux on a small internal project and so far =
I'm
>>>> really
>>>>> pleased with it. What I'm doing is very simple: I have to manage a =
few
>>>>> scripts and start them with the right command-line arguments (does =
the
>>>>> acronym CLA mean anything to anyone? I've never seen it used but =
it
>>>> would
>>>>> make my life so much easier). I use Servolux::Child objects for =
that.
>>>>>=20
>>>>=20
>>>> I'm glad you are finding Servolux useful!
>>>>=20
>>>>> Is there a way, internally, to know whether one of the processes
>>>> handled by
>>>>> the Child object has been kill-9'd by, say, an outside human hand? =
I
>>>> don't
>>>>> really know enough about the popen stuff and process communication =
to
>>>>> figure that out.
>>>>>=20
>>>>=20
>>>> The Servolux::Child class provides several methods to determine the
>>>> status of the child process.
>>>>=20
>>>> * alive? -- This method returns +true+ if the child process is =
still
>>>> alive. So if someone kills the process (kill -9) then this method =
will
>>>> return +false+. If this method returns +nil+, the the child process =
was
>>>> never started.
>>>>=20
>>>> There are several methods that map directly to the ruby =
Process::Status
>>>> class and can be used to find out exactly how and why the child =
process
>>>> exited. All of these methods can be called on your Servolux::Child =
instance:
>>>>=20
>>>> * coredump?
>>>> * exited?
>>>> * signaled?
>>>> * stopped?
>>>> * success?
>>>> * exitstatus
>>>> * stopsig
>>>> * termsig
>>>>=20
>>>> You can read the documentation for these methods here =3D>
>>>> http://ruby-doc.org/core-1.9.3/Process/Status.html
>>>> In your case the methods to look at are "signaled?" and "termsig". =
If
>>>> "termsig" returns 9, then someone used kill -9 to stop the process.
>>>>=20
>>>> Hope all this helps!
>>>>=20
>>>> Blessings,
>>>> TwP
>>>=20
>>>=20
>>>=20
>>=20


In This Thread

Prev Next