Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Is Process Running In The Background?

by gokuraku (Monk)
on May 01, 2008 at 13:35 UTC ( [id://683924]=note: print w/replies, xml ) Need Help??


in reply to Re: Is Process Running In The Background?
in thread Is Process Running In The Background?

Very nice...thank you it is what I needed.
This is running on HPUX and the one I found that works is the following:
$tpgrp = tcgetpgrp(fileno(*TTY)); $pgrp = getpgrp(); if ($tpgrp == $pgrp) { system("which which > whichtest"); } else { print "Skipping which as we are not interactive.\n"; }
I needed a change in this as the system call on HPUX gets the shell into a waiting state until it receives some input, which does not work well if we run it as a background process. Rather than skip doing this as a check, which we could do as the script is run manually at times, I wanted a way to have it run only when we needed it.

Log In?
Username:
Password:

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

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

    No recent polls found