Results 1 to 6 of 6

Thread: run terminal command at startup

  1. #1
    Join Date
    Feb 2013
    Beans
    2

    Question run terminal command at startup

    I am a very beginner to ubuntu. I have just installed ubuntu 12.0.4LTS in virtual box and try to run a start up script. But I have try many methods and all have failed.Bellow is my environment, please give any advise.
    1st: add JAVA_HOME and GRAILS PATH in user main folder's profile file
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
    fi
    export JAVA_HOME=/usr/java/jre1.7.0_13
    PATH=$PATH:$HOME/work/grails-2.0.3/bin

    2nd: because I want to run grails command at startup, so create shell file startD.sh
    #! /bin/sh
    cd work/comoon/code/grails-project
    grails run-app

    then what should I do to run this script in terminal at startup
    Last edited by comoon; February 8th, 2013 at 07:00 AM.

  2. #2
    Join Date
    Feb 2013
    Beans
    2

    Re: run terminal command at startup

    Anyone Can help me please or I have posted it in the wrong category?

  3. #3
    Join Date
    Nov 2006
    Location
    The green
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: run terminal command at startup

    Quote Originally Posted by comoon View Post
    Anyone Can help me please or I have posted it in the wrong category?
    Please wait a bit longer (24h) before bumping your thread.


    You can add scripts to run at startup in System settings -> Startup Applications
    #495467 - #35304

    <=> Problem solved? Mark thread solved

  4. #4
    Join Date
    Feb 2011
    Location
    Somewhere...
    Beans
    1,557
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: run terminal command at startup

    Or, the classic way, add it to .profile .

  5. #5
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    /etc/rc.local

    Quote Originally Posted by zombifier25 View Post
    Or, the classic way, add it to .profile .
    That will run it when you open a terminal.

    If you want it to run (as root) when the machine starts up, you can add it to /etc/rc.local

    When do you want it to run?

  6. #6
    Join Date
    Feb 2011
    Location
    Somewhere...
    Beans
    1,557
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: /etc/rc.local

    Quote Originally Posted by Lars Noodén View Post
    That will run it when you open a terminal.
    That would be .bashrc.
    .profile will run when you log in regardless of sessions.

Tags for this Thread

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
  •