andysayshi wrote:
Hey,
Hello,
Within a perl script of mine, I'd like to execute a shell command but have it sleep for a few minutes prior to doing so. There are probably better ways but I can't think/find any at the moment to do so, what I tried so far is shown here: system("sleep 90 ; some_command_here") but as you can guess... this doesnt kick the command off to the background and as a result the perl script will sleep as well. Is there anyway to kick this off to the background so that the perl script can continue on? I'd prefer not having to use additional modules to do so. In the meantime, I'll check out the fork function. Any ideas on how I can get this done?
Sure, something like this (untested): defined( my $pid = fork ) or die "fork failed: $!"; unless ( $pid ) { sleep 90; exec 'some_command_here'; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>