You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@vcl.apache.org by Mark Gardner <mk...@vt.edu> on 2013/09/12 18:15:50 UTC

Autostarting Application

There was a discussion during the today's VCL office hours about how to
automatically start up an application when the users logs into their
reservation.

Each of the Linux various distributions/window managers have ways of
starting up applications automatically. Unfortunately, it is
distribution/window manager specific.

Many of them allow you to save a default session with applications running.
This is probably the easiest to implement as you set up the master image.
Log in as the VCL user, start the application, make sure that the window
manager is configured to save the running applications into the session,
then logout. Test it by logging back in again. The application should
automatically be started.

Alternatively, the master image can be configured to automatically run an
application when a user logs in. Once again, this is detail dependent. Here
are a couple of examples. (Unfortunately, I don't use Gnome3 or Unity so I
can't tell you how to do it with the latest Ubuntu versions.)

--- xfce4 window manager

Method 1: 1) start up the desired application; 2) go to Application
Menu->Settings->Session and Startup->Application Autostart tab and
select/deselect what you want started automatically; 3) click the Close
button; 4) logout and back in to test.

Method 2: create a startup config file in the user's home directory by 1)
logging in as the user and 2) create the autostart config file; and 3) test.

cat << EOF > ~/.config/autostart/firefox.desktop
[Desktop Entry]
Type=Application
Name=Firefox
Comment=Start up Firefox on logging in.
Exec=/usr/bin/firefox &
StartupNotify=false
Terminal=false
Hidden=false
EOF

Here is another example. Method 2 also works for other/older/alternative
window managers... even if it isn't the "preferred" method for some of them.

-- openbox window manager

Method 1: see http://openbox.org/wiki/Help:Autostart for more details.

Method 2: add a line to the ~/.xsessions (or ~/.xinitrc) file in the user's
home directory to check for the application and start it up if found:

patch <<EOF
--- ~/.xsession~  2013-09-12 12:14:32.028700080 -0400
+++ ~/.xsession       2013-09-12 12:14:40.756805683 -0400
@@ -1,5 +1,7 @@
 #!/bin/sh

+[ -x /usr/bin/firefox ] && /usr/bin/firefox &
+
 # Start window manager (saving PID)
 /usr/bin/openbox-session & WMPID=$!
 wait $WMPID
EOF

Hopefully this helps. Reply if you still have questions. I am sure someone
on the list should be able to answer them.

Mark

-- 
Mark Gardner
--