Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-20-2004, 07:35 AM   #1
LQ Newbie
Registered: Nov 2004
Location: India
Distribution: Redhat,Knoppix
Posts: 5

Rep: Reputation: 0
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.


Last edited by kalpesh_rathod8; 11-21-2004 at 10:21 PM.
Old 11-20-2004, 09:24 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680
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.

Last edited by jschiwal; 11-20-2004 at 09:25 AM.
Old 11-22-2004, 04:19 AM   #3
LQ Newbie
Registered: Nov 2004
Location: India
Distribution: Redhat,Knoppix
Posts: 5

Original Poster
Rep: Reputation: 0
placing the starting script in xinitrc.d works.
Thanx for the help .


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
about displaying process memory usage maginotjr Slackware 2 09-13-2005 12:43 PM
Displaying a message when I start a new konsole. kponenation Slackware 6 08-14-2005 12:57 AM
Displaying message on FC1 roland_andrey Linux - Newbie 3 01-10-2005 07:50 PM
Displaying a message on terminal roland_andrey Linux - General 4 01-10-2005 05:53 PM
Creating message after logging into runlevel 3. darksky Red Hat 6 09-01-2003 09:22 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration