LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-31-2008, 01:35 AM   #1
maradnus
Member
 
Registered: Oct 2008
Location: Yellagiri Hills
Distribution: Fedora
Posts: 87

Rep: Reputation: 15
Question How to display a message box through a background script?


Dear all,

I wrote a program in C language which has to
display a message box on the screen (in X windows).

I used the following code
Code:
             system("kdialog --mesgbox \" Some Message text\"");
I works well When I run it in the background manually on the console
but It doesn't work When I put it in /etc/rc.local file.

/etc/rc.local contains the following line:

Code:
            /usr/local/bin/myprogram &
The above program gets executed but the dialog doesn't appear.


Please give me some idea...

Thanks
 
Old 10-31-2008, 03:49 AM   #2
roy_lt_69
Member
 
Registered: Aug 2006
Location: Vancouver, BC, Canada
Distribution: Slackware, Mint, Debian
Posts: 238

Rep: Reputation: 29
I am not an expert on rc.local but if I am not mistaken it is executed after the init scripts are run.
This has implications, such as you cannot assume X is running, it will probably be run with root privileges,
and be run before you have a chance to login as a user!
You might want to write to a log file or move your program so that it is executed after X is started or when a user logs in!

Have you tried running your program when booted to 'single-user mode' or one of the 'text-only modes' when X is not loaded?

What does your program do?
 
Old 10-31-2008, 04:10 AM   #3
barunva
LQ Newbie
 
Registered: Mar 2007
Location: Bangalore
Posts: 4

Rep: Reputation: 0
Smile

type msgbox instead of mesgbox, it should work.

system("kdialog --msgbox \" Some Message text\"");

Regards,
B.Arunachalam
 
Old 10-31-2008, 08:57 AM   #4
maradnus
Member
 
Registered: Oct 2008
Location: Yellagiri Hills
Distribution: Fedora
Posts: 87

Original Poster
Rep: Reputation: 15
Question

Dear Roy,

Thanks for reply..

The purpose of the program is to remind the user about
the time of shutdown.

So the C program will be running in the background and checks
the system time repeatedly for every five minutes.
When the system times lies in between the specified time,
the program will show the appropriate message to the user
using kdialog and after few minutes it will shutdown the system.

The program shuts down the system exactly when somebody works
with Desktop(X and multiuser mode) but the dialog was not displayed....

thanks
 
Old 10-31-2008, 09:00 AM   #5
maradnus
Member
 
Registered: Oct 2008
Location: Yellagiri Hills
Distribution: Fedora
Posts: 87

Original Poster
Rep: Reputation: 15
Question

Dear barunva,

Thanks for your reply.

It was a typing mistake but in the program i gave correctly.

thanks.
 
Old 10-31-2008, 10:57 AM   #6
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
IMHO you'd better add the line running your program into each user ".bashrc" file, and for future users into "/etc/skel/.bashrc"
 
  


Reply



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
Bash script hangs upon starting another script in the background masea2 Linux - Software 4 11-13-2006 05:18 AM
Background Message jake2 Fedora 1 07-10-2006 02:44 AM
Password Message Box when accessing linux box from Window Machine mikeccs Linux - Networking 1 08-04-2004 05:47 AM
Linux box calling a batch script on a windows box to run? Is it possible? joelhop Programming 8 05-17-2004 04:49 PM
how to produce pop-up message box / alert window from shell script peb Linux - Newbie 3 02-25-2004 03:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:21 PM.

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