hSindhu
asked on
Running infinite while loop in PERL as a background process
Hi Folks!
I have a script which has an infinite while loop(while(1) { ........}) acts as a control logic for
all the activities with in the script and is running on a unix platform.
Whenever I run this program, due to the infinite loop, the terminal window will be under
the control of the script(window will be grabbed by the script) and the user will not be able to
use that particular terminal until the jobs gets over.
If run this script with an '&' option , it produces 'suspended tty' at the command prompt
and the process doesn't take place.
Is there any option in perl to run the infinite loops as a background process on unix?
( except cron jobs)
If anybody knows the answers please respond asap and your feedback will be
highly appriciated.
regards,
--Srikanth
I have a script which has an infinite while loop(while(1) { ........}) acts as a control logic for
all the activities with in the script and is running on a unix platform.
Whenever I run this program, due to the infinite loop, the terminal window will be under
the control of the script(window will be grabbed by the script) and the user will not be able to
use that particular terminal until the jobs gets over.
If run this script with an '&' option , it produces 'suspended tty' at the command prompt
and the process doesn't take place.
Is there any option in perl to run the infinite loops as a background process on unix?
( except cron jobs)
If anybody knows the answers please respond asap and your feedback will be
highly appriciated.
regards,
--Srikanth
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does the process attempt to read from the tty while in the loop?
perldoc -q background
This looks like a daemon process to me.
In theory, its design should fork off child which dosnt have any
terminal attached. The parent then dies off and init becomes parent
of the process. Hence the process lives indefinitely.
Manav