Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Add startup application by command line

  1. #1
    Join Date
    Mar 2006
    Beans
    153

    Question Add startup application by command line

    I would like to know how to use the command line to add a startup application. I know how to do it graphically as in System->Preferences->Startup Applications->Add or check/uncheck an application. How would I do this by the command line. Is there a configuration file that I can edit for this?

    The reason I want to do this is when I remote into a machine using ssh, I don't have access to the Gnome GUI.

  2. #2
    Join Date
    Aug 2006
    Location
    Michigan
    Beans
    392
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Add startup application by command line

    I would read more on update-rc.d:
    Code:
    man update-rc.d
    This is a good read and you will also need to understand LSBinitScripts:
    ---
    http://wiki.debian.org/LSBInitScripts
    ---

    If you have any additional information on what init level you need an application to start, any requirements for starting up or shutting down and I can give you a better step-by-step entry on what you need to do.
    ThisIsBryan: The Site | About Me
    HowTo: Setup Ubuntu Desktop with LVM Partitions WIKI
    Hardware Profile: Dell XPS 14z; 4GB DDR3 RAM; 700GB HD; Intel Corporation Centrino Advanced-N 6230; Intel i7 CPU @ 2.80 GHz

  3. #3
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Add startup application by command line

    Quote Originally Posted by Z.K. View Post
    I would like to know how to use the command line to add a startup application. I know how to do it graphically as in System->Preferences->Startup Applications->Add or check/uncheck an application. How would I do this by the command line. Is there a configuration file that I can edit for this?

    The reason I want to do this is when I remote into a machine using ssh, I don't have access to the Gnome GUI.
    Just copy (delete) the application's .desktop file to (from) ~/.config/autostart/

    The .desktop files are usually located at /usr/share/applications, but you can create a custom one if you want.

    For more info, check out:

    http://standards.freedesktop.org/aut...-spec-0.5.html
    and
    http://standards.freedesktop.org/des...ec-latest.html

  4. #4
    Join Date
    Sep 2011
    Location
    India
    Beans
    123
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Add startup application by command line

    Thanks. It is somewhat useful information.

  5. #5
    Join Date
    Apr 2008
    Location
    Far, far away
    Beans
    2,148
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Add startup application by command line

    You have a couple different issues here.

    The GUI method you know about actually adds an app to start when you login using the .desktop method above

    The update-rc.d (or more current Upstart, /etc/init/*.conf) methods both start a program when the system starts (boots), which is before you login and will start even if you don't login.

    Neither are going to run a program when you login with ssh remotely. For that the simplest method is to add the command to your ~/.bashrc (but then it will also run when you open a terminal).

    Another way is to create a ~/.ssh/config file and add a LocalCommand option for the host (and PermitLocalCommand) - see man ssh_config.

    There are other ways with ssh as well - eg. it's simple to add the command to the ssh login command itself, but if you want to have a active shell then you would need to run a script that runs your program and opens a sub-shell. No doubt someone will chime in with a smart way to do that too.
    Last edited by BkkBonanza; September 22nd, 2011 at 04:09 PM.
    Send tips to: 17raXAGM42vZX21Vcb5HDwq2GMLmVwN4qd

  6. #6
    Join Date
    Nov 2008
    Location
    Sheffield, UK
    Beans
    1,514
    Distro
    Ubuntu

    Re: Add startup application by command line

    crontab -e
    add something like

    @reboot /bin/ls

  7. #7
    Join Date
    Nov 2006
    Location
    Melbourne (Victoria, OZ)
    Beans
    925
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Add startup application by command line

    Does anyone know the actual command to initiate the "Startup Applications" app? I've upgraded to 12.04, and at least in the Classic desktop which I use, there is now no way to access it via GUI (my user menu looks like in 11.10, and there is no "Startup Applications" there like I see in 12.04 screenshots. I'd rather use that than be dragging .desktop files in and out of ~/config/autostart. Cheers.
    Soylent Green is PEOPLE!!!

    =D> First Stop for Ubuntu Newbies

  8. #8
    Join Date
    Apr 2008
    Location
    Far, far away
    Beans
    2,148
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Add startup application by command line

    I just checked my menu item properties for "Startup Applications" in 11.04 and it lists, gnome-session-properties as the app it runs.
    Send tips to: 17raXAGM42vZX21Vcb5HDwq2GMLmVwN4qd

  9. #9
    Join Date
    Nov 2006
    Location
    Melbourne (Victoria, OZ)
    Beans
    925
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Add startup application by command line

    Quote Originally Posted by BkkBonanza View Post
    I just checked my menu item properties for "Startup Applications" in 11.04 and it lists, gnome-session-properties as the app it runs.
    Thanks buddy! And yeah, after the 12.04 upgrade, all those "System" menu items that ended up in Applications > Other when Gnome 3 got rid of that menu (for reasons I've still yet to fathom) have totally disappeared, yet obviously the apps are still around. Cheers.
    Soylent Green is PEOPLE!!!

    =D> First Stop for Ubuntu Newbies

  10. #10
    Join Date
    May 2012
    Beans
    1

    Re: Add startup application by command line

    ubuntu 12 classic fall back using GUI.

    http://ubuntugenius.wordpress.com/20...lback-desktop/

    Unity sucks

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •