Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > nohup in perl

Reply
Thread Tools

nohup in perl

 
 
justme
Guest
Posts: n/a
 
      06-28-2004
hi

is there an equivalent implementation of nohup in perl, something
like system("nohup $command" ) ??

thanks
 
Reply With Quote
 
 
 
 
Jaap Karssenberg
Guest
Posts: n/a
 
      06-28-2004
How about:

sub nohup {
local $SIG{HUP} = 'IGNORE';
my $pid = fork;
if ($pid) { return $pid } # parent
else { # child
#.... command code here
}
}

of course I have no idea what you are trying to do, so I can't really
say if this would be wise to use

--
) ( Jaap Karssenberg || Pardus [Larus] | |0| |
: : http://pardus-larus.student.utwente.nl/~pardus | | |0|
) \ / ( |0|0|0|
",.*'*.," Proud owner of "Perl6 Essentials" 1st edition wannabe
 
Reply With Quote
 
 
 
 
Steven N. Hirsch
Guest
Posts: n/a
 
      06-28-2004
Jaap Karssenberg wrote:
> How about:
>


use POSIX;

> sub nohup {
> local $SIG{HUP} = 'IGNORE';
> my $pid = fork;
> if ($pid) { return $pid } # parent
> else { # child

setsid() or die "Cannot establish session id: $!\n";
> #.... command code here
> }
> }


You probably want to disassociate from the current session ID, per above.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Behaviour of subprocess.Popen, ssh and nohup I don'tunderstand Adriaan Renting Python 0 03-31-2011 11:01 PM
Re: nohup and os.system Cameron Simpson Python 0 03-12-2009 05:37 AM
nohup and os.system Gideon Python 0 03-12-2009 04:05 AM
print statements not sent to nohup.out John [H2O] Python 2 10-25-2008 04:32 AM
get pid of a nohup command in Python g.willgoose@telluricresearch.com Python 1 02-13-2007 05:52 AM



Advertisments