|
Author |
Message |
|
|
Posted Jul 05, 2008 at 2:07:13 PM
Subject: xmessage is not working from a start-up-at-boot program
I have written a program for scada application. I used a script to automatically start it at run-level 5 with $ALL option so that the script starts after other scripts. Now, the program gets executed at boot time. It forks into memory and stays active. It works fine and reports issues to syslog. But, xmessage command does not work!! ie: When the program finds an issue (it connects to scada controller through com port), it has to pop up message and it also has to write to syslog. Writing to syslog works fine, but, popup doesn't work !! Pop up is done using xmesage command. Pop-up works fine if I execute the progeam by doubleclicking on the script, or invoke it in terminal mode. ie: After system boots up, if I manually execute the program, xmessage works fine and the windows pop up. Both the script and the program has 777 as permission attribute. Program owner is root, and I am logging in as root, always. But xmessage doesn't work if the program is part of start-up!! In the script, I have asked the program to be started only ar runlevel 5. Where is the mistake? I am trying it in Suse. Program was written is C. It just invokes system(xmessage(mymsgstring)) . Please help.
|
Dark Falcon
Joined Jul 12, 2008 Posts: 3
Other Topics
|
Posted:
Jul 12, 2008 10:48:18 PM
Subject: xmessage is not working from a start-up-at-boot program
I would suspect that xmessage relies on the DISPLAY environment variable to find the X server, and that this variable is not set.
|
Dark Falcon
Joined Jul 12, 2008 Posts: 3
Other Topics
|
Posted:
Jul 12, 2008 10:53:02 PM
Subject: xmessage is not working from a start-up-at-boot program
To confirm, xmessage calls XtAppInitialize, which calls XOpenDisplay with a null display_name string. Here's what this does:
The XtOpenDisplay function calls XOpenDisplay the specified display
name. If display_string is NULL, XtOpenDisplay uses the current value
of the -display option specified in argv and if no display is specified
in argv, uses the user's default display (on UNIX-based systems, this
is the value of the DISPLAY environment variable).
So you might check to make sure DISPLAY is set.
|
Tom Adams
Joined Jul 13, 2008 Posts: 1
Other Topics
|
Posted:
Jul 13, 2008 8:48:01 PM
Subject: xmessage is not working from a start-up-at-boot program
I had a similar problem with DBUS, so I put this in my GNOME "Startup Programs":
sh -c 'echo $DBUS_SESSION_BUS_ADDRESS > .dbus'
And I prefixed the commands in crontab with:
DBUS_SESSION_BUS_ADDRESS=`cat .dbus`
|
Raj
Joined Jun 26, 2008 Posts: 8
Other Topics
|
Posted:
Jul 17, 2008 2:37:05 PM
Subject: xmessage is not working from a start-up-at-boot program
How do I set the display variable with setenv or putenv functions? Any guidance could be greatly helpful. Searched the net but couldn't find any sample codes...
|