This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Launching a Graphical App

Posted by: Anonymous [ip: 204.8.156.142] on August 23, 2008 04:29 AM
Probably the best way to launch a graphical app would be something like:

/home/linuxlala IN_CLOSE_WRITE su linuxlala -c "/home/linuxlala/bin/script $@ $#"

Where /home/linuxlala/bin/script does some sanity checks such as making sure the user linuxlala is actually using the GUI and then setting $DISPLAY appropriately and launching the desired app. Note that I passed $@ and $# as parameters for use by the script. Also, the script is being run by user linuxlala so I am not opening a security hole.

If you just need something quick-n-dirty, set $DISPLAY and su to the appropriate user and call the app.

@Anonymous [ip: 71.142.66.74]

I just tried

35 * * * * root DISPLAY=:1 su username -c /usr/X11R6/bin/xterm

in /etc/crontab (where user username was using :1) and it worked just fine.

#

Return to Scheduling jobs based on filesystem activity with incron