Link to home
Start Free TrialLog in
Avatar of hSindhu
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
ASKER CERTIFIED SOLUTION
Avatar of gripe
gripe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of manav_mathur
manav_mathur

Dunno about PERL, but did you try nohup?

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
Avatar of ozo
Does the process attempt to read from the tty while in the loop?
perldoc -q background