-   Programming (
-   -   displaying popuo message by daemon process running in runlevel 5 using xmessage (

kalpesh_rathod8 11-20-2004 07:35 AM

displaying popup message by daemon process running in runlevel 5 using xmessage
Hello friends,
I m using redhat9 and I m programming my application in C.My application process runs as daemon.I have configured it using chkconfig to run in runlevel 5.For simplicity consider the simplest code.

//file test.c
system("xmessage Hello World");

Now If I run following program by simply saying test& at bash prompt it works fine and displays dialog box with "Hello World" when condition is satisfied.

I have written the script named test to start/stop the daemon and placed it in /etc/init.d..Now if I run
service test start
at bash prompt then also it works fine.

But If I configure service using chkconfig to run in runlevel 5 and when it gets started by system automatically then the program is not working i.e it's not able to display dialog box using system("xmessage Hello World");

To understand what goes wrong i checked the daemon process using

ps -e | grep test

In former two cases this show that daemon has control terminal pts/0

whears in last case it has no control terminal i.e ? is shown.

upto my knowledge due to this system function is not if this is the problem then is it possible the daemon started by init to have control terminal?

I know daemons are not supposed to perform such tasks,so you can suggest me any solution that satisfies two basic requirement.
(1)process to start in runlevel 5 and run till system is on.
(2)It must be able to dispaly dialog box using system("xmessage Hello World");
(3)and it must be started automatically without any user interaction when system is switched to runlevel5

Now,I think it is clear.So plz help me.


jschiwal 11-20-2004 09:24 AM

You want to use the Xwindows startup scripts like xinitrc. If you wrote a KDE program then use the kde startup folder.

You might consider rewriting your program by dividing it into a clent/server pair of programs, with a standard type of startup script which starts the server for run level 5.
The server would record the message that you want displayed to users when they log in, and the x-client program would request the message when x-windows starts up.

Here is a web site which explains the X windows startup process.

kalpesh_rathod8 11-22-2004 04:19 AM

placing the starting script in xinitrc.d works.
Thanx for the help .

All times are GMT -5. The time now is 03:18 PM.