Thursday, July 30, 2009

Running any process in background from perl script

If you want to run any process in background from your perl script as follows:

system("start [process]");

By using the above command, a new command window will get opened and the process will start running on that command window and control will return to your perl script from where you called this command, so the very next command can also be executed.

But if you use system("[process]"); then it will run on same command window and control will come back once the process is completed.

e.g.
system("start tail -f abc.txt");
print("Tail command is running in background\n");

will call a new command window and "tail -f " command will be executed in that and then print command will get called.

No comments:

Post a Comment