Cron is not the program you're after. To run GUI programs there are different approaches. Which one to choose depends on your desktop environment.
The traditional way is to hook it into your .xinitrc file before starting the window manager. A simple example .xinitrc looks as follows:
#!/bin/sh
# Play a login sound
ogg123 -q "${HOME}/Music/login.ogg" &
# Start a terminal emulator
urxvt -T Terminal &
# Start the window manager
exec awesome
Depending on the desktop environment, you can also use ~/.config/autostart/
and create a program.desktop
file. Check that directory, if it already contains entries. That's the easiest way, I guess.
autostart […] defines a method for automatically starting applications during the startup of a desktop environment […]
Source: freedesktop autostart specification
Have a look at /etc/X11/xinit/xinitrc
(this may be different places on different systems) to see what files it sources. Generally, this will have an if..elif..else structure, so that only one initialization file is read, with $HOME/.Xclients
prioritized then /etc/X11/xinit/Xclients
. That's almost certainly where the terminal that appears comes from (I am presuming you do not have a desktop environment installed or anything).
Anyway, if you just want to run a single GUI app, create (or modify) an Xclients file like this:
#!/bin/sh
myGUIapp
This should be executable. It's pretty much a normal shell script, I believe, so you can have more stuff in there, although obviously not backgrounding a GUI app will block execution at that point.
[later addition]
Your installation doesn't have exactly those files, but it does have an /etc/X11/Xinit.d
and if you look, I am sure those are short shell scripts and they are sourced from somewhere, probably one of the files in /etc/X11
-- Xsession
, Xserver
, or xserver-common
. You might want to check if $XINITRC
is defined in your environment; that will be a clue.
Your best bet is probably to just create a $HOME/.Xclients
file (or as jofel mentions, $HOME/.xinitrc
, which is probably more universal) and try it -- exactly that spelling and case, with a leading dot, and it should be set chmod 755
(the group and other permissions may not matter). Almost certainly this will be sourced from somewhere properly.
You can put files in /etc/X11/Xinit.d
yourself, but doing it for this purpose is not a good idea because yours should run last and block further execution. So have a look at the scripts in /etc/X11
(again: Xsession
, etc., they don't have a .sh
suffix) and try to figure out in what order they all chain together. It is also likely that somewhere one of them checks
for an Xclients
file, eg via something like
if [ -x /some/path/Xclients ]; then
$HOME
may also be used, and .xinitrc
. Which is why creating at least one of these variations should work (write the file and move around/rename it if at first you don't succeed). To summarize: prime candidates for the name: .xinitrx
and .Xclients
, in either $HOME
or /etc/X11/
, but if in the later, ditch the leading dot.
Best Answer
Oops a accidently gave you the Luna code. I upgraded the my system and afterwords used the ubuntu 14.04 code, it did not work, maybe because of gtk 3.14 upgrade(I should have tried it before upgrading).
Luckily I found something that did work.
Type this in the terminal: gnome-session-properties
Type in your password, a application will appear.