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 until I
> stop the vpn connection. When I stop the vpn connection then the perl
> script continues which does a whole bunch of post vpn clean up.
>
> 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? If for some reason my shell
> window closes while it's running my vpn connection, then my perl
> script dies and will not have a chance to do any post vpn clean up
> stuff that's it's programmed to do.
>
> Thanks all!
The easiest way would be to use GNU screen or something similar:
* http://www.gnu.org/software/screen/
* http://tmux.sourceforge.net/
If you want to do it inside Perl you can look at
http://perldoc.perl.org/functions/fork.html ,
http://perldoc.perl.org/perlipc.html and multi-tasking.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
"Humanity" - Parody of Modern Life - http://shlom.in/humanity
Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/