Re: How to keep script alive if my shell closes

2010-02-13 Thread Jeff Peng
On Thu, Feb 11, 2010 at 6:39 AM, Shawn H Corey wrote: > > You can do the same thing inside Perl with %SIG: > >  $SIG{HUP} = 'IGNORE'; > Also "nohup" redirect all stdout and stderr to a file "nohup.out". So you have also to reopen STDOUT and STDERR to a file handle if doing it in the script. btw

Re: How to keep script alive if my shell closes

2010-02-13 Thread Ariel Casas
All I needed to do is add: $SIG{HUP} = 'IGNORE'; I tested it by killing my terminal window while an active vpn connection and confirmed that my perl script runs it's post vpn cleanup stuff even after the terminal window closed. Thanks Shawn! Ariel C. On Feb 10, 2:39 pm, shawnhco...@gmail.com

Re: How to keep script alive if my shell closes

2010-02-13 Thread Alan Haggai Alavi
Hello Ariel, You could use either GNU Screen (http://www.gnu.org/software/screen/) or `nohup` command to run your script. Regards, Alan Haggai Alavi. -- The difference makes the difference. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h..

Re: How to keep script alive if my shell closes

2010-02-13 Thread Shawn H Corey
C.DeRykus wrote: > I'd think 'nohup perl a.pl' would be a smidge safer though since > the script is vulnerabe during startup/loading before the 'IGNORE' > is seen. Of course, you could mitigate risk by setting the 'IGNORE' > inside a BEGIN{}. But nohup has the same "vulnerability" since it doe

Re: How to keep script alive if my shell closes

2010-02-13 Thread C.DeRykus
On Feb 10, 2:39 pm, shawnhco...@gmail.com (Shawn H Corey) wrote: > Jeff Peng wrote: > > On Wed, Feb 10, 2010 at 2:40 AM, Ariel Casas wrote: > > >> My question is; how do I keep my perl script from dying if my shell > >> window accidentally closes while my perl script is paused at the > >> system f

Re: How to keep script alive if my shell closes

2010-02-10 Thread Shawn H Corey
Jeff Peng wrote: > On Wed, Feb 10, 2010 at 2:40 AM, Ariel Casas wrote: > >> My question is; how do I keep my perl script from dying if my shell >> window accidentally closes while my perl script is paused at the >> system function portion of my script? > > Hi, > > Make a daemon process for runn

Re: How to keep script alive if my shell closes

2010-02-10 Thread Jeff Peng
On Wed, Feb 10, 2010 at 2:40 AM, Ariel Casas wrote: > > My question is; how do I keep my perl script from dying if my shell > window accidentally closes while my perl script is paused at the > system function portion of my script? Hi, Make a daemon process for running in the script, or use nohu

Re: How to keep script alive if my shell closes

2010-02-10 Thread Shlomi Fish
On Tuesday 09 Feb 2010 20:40:02 Ariel Casas wrote: > Hello all, > I've created a perl script that creates a vpn connection, I call the > vpn connection with the perl system function eg. > > system("vpnclient connect company_lan") ; > > With the system function, the perl script will not continue u