Operating System - Linux
1756704 Members
2447 Online
108852 Solutions
New Discussion юеВ

Re: init.rc script fails because tty detach

 
SOLVED
Go to solution
manoj_pu
Regular Advisor

Re: init.rc script fails because tty detach

Burslan,

You are exactly right.

But that does not work to "demonize" the mwm process in the system startup.

Do you have any other catch on it???
Leave with out tense and try best you gets result
Mel Burslan
Honored Contributor

Re: init.rc script fails because tty detach

To the best that I know daemons are written, compiled and linked to be daemons. You can not just expect any executable to be run as a daemon in the full meaning of it. nohup and running it in the background as a detached process is the best thing you can do without re-writing the whole program yourself.

Some programs have the option of running themselves ad daemons, like sendmail, with proper command switches but a quick glance over mwm does not show anything close to this.

Also, running a process in the background, doing whatever you are expecting from it to do, is not much different than the actual daemon functionality, maybe with a bit of extra overhead due to shell handling etc. What else are you after by runnig it as a *true* daemon ?
________________________________
UNIX because I majored in cryptology...
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: init.rc script fails because tty detach

If you must daemonize a process using a scripting language then Perl is your best bet. It lets you use setsid() to detach the process from a controlling terminal. Try the attached Perl script and make your changes in the "exec" function. The idea is that the process forks() then the parent is allowed to exit; the child then sets up any signal handlers and does an exec(). It's also a good idea for all daemons to to a cd to / so that umounts won't fail with "device busy".
If it ain't broke, I can fix that.
manoj_pu
Regular Advisor

Re: init.rc script fails because tty detach

All,

Finally the the story end successfully!!!
Special thanks to Stephenson for wonderful perl script.

Thanks & Best Regards

Manoj
Leave with out tense and try best you gets result