Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: OpenOffice Quickstarter (Linux) in Perl

by Corion (Patriarch)
on Mar 08, 2004 at 11:49 UTC ( [id://334768]=note: print w/replies, xml ) Need Help??


in reply to OpenOffice Quickstarter (Linux) in Perl

To prevent the ps ax|grep combo from finding itself, I encode one char within a character class like this:

ps ax|grep '[s]office.bin -quickstart'

I would maybe move the whole loop out of the program and put it into a cron job that runs every minute instead, but other than that, I'm not exactly sure what you're looking for.

Replies are listed 'Best First'.
Re: Re: OpenOffice Quickstarter (Linux) in Perl
by kal (Hermit) on Mar 08, 2004 at 12:00 UTC

    The "ps not finding itself" problem is usually soluable with pgrep, which is present in Solaris, GNU/Linux, and probably most other modern OSes of similar type. Functionally, it's not really any different than your trick above, but pgrep is so useful I thought it was worth a separate mention.

    I would think a better way - rather than looping based on timeout - would be to fork, exec() OOo in the child, and then join the child. That would have the loop effect, but without the constant polling. It would (probably) remove the need to look for the process too, which could be useful (do you know whether or not your user has the ability to talk to the other process, for example? I don't know the answer to that, but I would think it would be an obvious question).

Re: Re: OpenOffice Quickstarter (Linux) in Perl
by belg4mit (Prior) on Mar 08, 2004 at 13:16 UTC
    Using the c option of GNU grep uses only the executable name

    --
    I'm not belgian but I play one on TV.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://334768]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found